I want to know how to detect if an iPhone has moved in the last 60 sec using swift
I came across this code below, but only works when phone is shaken.
Is it possible to detect when phone is moved but not vigorously shaken?
override func motionEnded(motion: UIEventSubtype,
withEvent event: UIEvent?) {
if motion == .MotionShake {
let controller = UIAlertController(title: "Shake",
message: "The device is shaken",
preferredStyle: .Alert)
controller.addAction(UIAlertAction(title: "OK",
style: .Default,
handler: nil))
presentViewController(controller, animated: true, completion: nil)
}
}