How to draw a line in Swift 3
<p>I would like the user to touch 2 points and then a line is drawn between those two points. Here is what I have so far:</p>

<pre><code>func drawline(){
    let context = UIGraphicsGetCurrentContext()
    context!.beginPath()
    context?.move(to: pointA)
    context?.addLine(to: pointB)
    context!.strokePath()
}
</code></pre>

<p><code>pointA</code> is the first point the user touched and <code>pointB</code> is the second point. I get the error: </p>

<pre><code>thread 1:EXC_BREAKPOINT
</code></pre>

<p>Thanks in advance for your help.</p>