title: Swift: How to pull out CGPoint number from Override func of touch?
body: <p>I am using the codes shown below for letting user to touch and draw. During touching it, user always leaves CGPoint or coordinates of his/her first and last touch. </p>
  
  <pre><code>var lastPoint: CGPoint!
  var firstPoint: CGPoint!
  var swiped: Bool!
  var allowTouches = true
  
  
  
  override func touchesBegan(touches: Set&lt;UITouch&gt;,
                          withEvent event: UIEvent?) {
      guard allowTouches else {
          return
      }
  
  
      swiped    = false
      if let touch = touches.first {
      lastPoint = touch.locationInView(self.imageView)
        firstPoint = lastPoint
  
      }
  
  }
  
  
   override func touchesMoved(touches: Set&lt;UITouch&gt;,
                              withEvent event: UIEvent?) {
  
      guard allowTouches else {
          return
      }
  
  
      swiped = true;
  
      if let touch = touches.first {
  
          let currentPoint = touch.locationInView(imageView)
          UIGraphicsBeginImageContext(self.imageView.frame.size)
          self.imageView.image?.drawInRect(CGRectMake(0, 0, self.imageView.frame.size.width, self.imageView.frame.size.height))
  
          CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y)
          CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y)
          CGContextSetLineCap(UIGraphicsGetCurrentContext(),CGLineCap.Round)
          CGContextSetLineWidth(UIGraphicsGetCurrentContext(), 5.0)
  
          CGContextStrokePath(UIGraphicsGetCurrentContext())
          self.imageView.image = UIGraphicsGetImageFromCurrentImageContext()
          UIGraphicsEndImageContext()
  
  
          lastPoint = currentPoint
  
            }
  
        }
  </code></pre>
  
  <p>As you can see in the code that firstPoint saves the coordinates when user touches the screen and after swiping and then removing the touch, lastPoint saves the coordinates. </p>
  
  <p>My question: how can I get those two coordinates(firstPoint and lastPoint) as return from override func? so that I can use these two values for other calculations outside override func.</p>