Ios 在SpriteKit和swift 3中使用我的手指绘图

Ios 在SpriteKit和swift 3中使用我的手指绘图,ios,swift,sprite-kit,Ios,Swift,Sprite Kit,我在网上找到了这段代码,但发布的代码并不完整,所以如果有人能帮我做以下事情的话 override func touchesBegan(touches: NSSet!, withEvent event: UIEvent!) { touch = touches.anyObject() as UITouch! firstPoint = touch.locationInNode(self) } override func touchesMoved(touches: NSSet!, wi

我在网上找到了这段代码,但发布的代码并不完整,所以如果有人能帮我做以下事情的话

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
}

lineNode和pathToDraw是什么?如果您能告诉我如何编写它们的代码,或者将我重定向到一些有帮助的地方。

class YourClassName{var pathToDraw:CGMutablePathRef?var lineNode:SKShapeNode?………..}
这能解决您的问题吗@丹尼尔·马卡姆雷