swift - What is this Override error and how do I fix it? -
this question has answer here:
i making ios game moving character , rotating weapon, worked took month break , ios got update 9. code no longer works , gives me error. error , more importantly how go fixing it?
 override func touchesmoved(touches: set<nsobject>, withevent event: uievent) {     touch in (touches as! set<uitouch>) {         let location = touch.locationinnode(self)         if (leftbutton.containspoint(location)){             leftpressed = true         }else{             leftpressed = false         }         if (rightbutton.containspoint(location)){             rightpressed = true         }else{             rightpressed = false         }     } } that 1 of code snippets gets error. here error: method not override method superclass
what happened during update ios 9, function changed , implementation outdated , no longer valid.
read documentation here (already @ function using).
you defined function as
touchesmoved(touches: set<nsobject>, withevent event: uievent) the new implementation is
touchesmoved(touches: set<uitouch>, withevent event: uievent?) your implementation takes different data type argument , therefore not same function , why getting override error.
Comments
Post a Comment