I can't seem to get the motion detection methods to work with Swift 2.0/Xcode 7. The error I'm getting indicates: 'Method does not override any method from its superclass'. I want to detect various motions using the built in UIEvent methods.. i.e. shake. Here's what I have inside the class
//this is used for detecting UIEvents i.e. 'Shake'
override func canBecomeFirstResponder() -> Bool {
return true
}
....
override func motionEnded(motion: UIEventSubtype, withEvent event: UIEvent)
{
if motion == .MotionShake && randomNumber == SHAKE
{
print("SHAKE RECEIVED")
correctActionPerformed = true
}
else if motion == .MotionShake && randomNumber != SHAKE
{
print("WRONG ACTION")
wrongActionPerformed = true
}
else
{
print("WRONG ACTION")
wrongActionPerformed = true
}
}
The same problem was encountered here: Swift 2 migration problems