Solution to the Golden Challenge

Post here only the code relevant to the solutions.

struct Line {

...
var width = CGFloat(10)
...

}

class DrawView: UIView, UIGestureRecognizerDelegate {

...
private var adjustedLineThickness: CGFloat {
    let velocity = moveRecognizer.velocity(in: self)
    let x = abs(velocity.x)
    let y = abs(velocity.y)
    let result = max(x, y)
    if result < 10.0 {
        return result * 10.0
    } else if result > 80 {
        return result / 80
    } else {
        return result
    }
}

private func stroke(_ line: Line) {
    ...
    path.lineWidth = line.width
    ...
}

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
    ...
            let newLine = Line(begin: location, end: location, width: adjustedLineThickness)
    ...
}

override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
    print(#function)
    ...
        for touch in touches {
            ...
            currentLines[key]?.width = adjustedLineThickness
        }
    }
    setNeedsDisplay()
}

}