title: Draw lines with Sprite kit and swift
body: <p>I'm using Sprite kit with Swift to assay drawing lines with fingers.</p>
  
  <p>Code:</p>
  
  <pre><code>override func touchesBegan(touches: NSSet!, withEvent event: UIEvent!) {
      touch = touches.anyObject() as UITouch!
      firstPoint = touch.locationInNode(self)
  }
  
  override func touchesMoved(touches: NSSet!, withEvent event: UIEvent!) {
      var touch = touches.anyObject() as UITouch!
      var positionInScene = touch.locationInNode(self)
  
      lineNode.removeFromParent()
      CGPathMoveToPoint(pathToDraw, nil, firstPoint.x, firstPoint.y)
      CGPathAddLineToPoint(pathToDraw, nil, positionInScene.x, positionInScene.y)
      lineNode.path = pathToDraw
      lineNode.lineWidth = 10.0
      lineNode.strokeColor = UIColor.redColor()
  
      self.addChild(lineNode)
      firstPoint = positionInScene
  }
  
  override func touchesEnded(touches: NSSet!, withEvent event: UIEvent!) {
  
  }
  </code></pre>
  
  <p>But the lines obtained are empty, only the border has color (image).</p>
  
  <p><img src="https://i.stack.imgur.com/xQISg.jpg" alt="enter image description here"></p>
  
  <p>Any idea?</p>