Why does this code results to "Type 'CGPoint' does not conform to protocol 'AnyObject'"?
let mutableSet = NSMutableSet()
override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
/* Called when a touch begins */
touch = touches.anyObject() as UITouch!
mutableSet.addObject(touch.locationInNode(self))
}
NSMutableSet
only accepts reference types, butCGPoint
is a struct, a value type. You can wrap the point in anNSValue
to add it.