Whenever I try to use a NSTimer
using the target of self
an error pops up saying
argument type 'NSObject-> () -> GameScene' does not conform to expected type 'AnyObject'.
Just to be on the safe side I also tried adding in AnyObject
instead of self
:
class GameScene: SKScene {
var point = SKSpriteNode(imageNamed: "Point")
override func didMoveToView(view: SKView) {
}
var timer = NSTimer.scheduledTimerWithTimeInterval(0.0001, target: self, selector: ("stroke"), userInfo: nil, repeats: true)
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
for touch in touches {
let location = touch.locationInNode(self)
func stroke(){
point.position = CGPoint(x: location.x, y: location.y)
self.addChild(point)
}
}
}
}