title: Draw a line with UIBezierPath
body: <p>First time using BezierPaths, wondering how this function is actually supposed to be implemented. Currently the bezier path moves within the frame of the image, as opposed to drawing on screen.</p>
  
  <p>Is there a better way to do it?   </p>
  
  <pre><code>func drawLineFromPoint(start : CGPoint, toPoint end:CGPoint, ofColor lineColor: UIColor, inView view:UIView) {
  
      var maxWidth = abs(start.x - end.x)
      var maxHeight = abs(start.y - end.y)
  
      var contextSize : CGSize!
      if maxWidth == 0 {
          contextSize = CGSize(width: 1, height: maxHeight)
      }else {
          contextSize = CGSize(width: maxWidth, height: 1)
      }
  
      //design the path
      UIGraphicsBeginImageContextWithOptions(contextSize, false, 0)
      var path = UIBezierPath()
      path.lineWidth = 1.0
      lineColor.set()
  
      //draw the path and make visible
      path.moveToPoint(start)
      path.addLineToPoint(end)
      path.stroke()
  
      //create image from path and add to subview
      var image = UIGraphicsGetImageFromCurrentImageContext()
      var imageView = UIImageView(image: image)
      view.addSubview(imageView)
      UIGraphicsEndImageContext()
  }
  </code></pre>