diff --git a/ProjectClock/AlarmActivationViewController.swift b/ProjectClock/AlarmActivationViewController.swift index e0244d1..7e2f1f2 100644 --- a/ProjectClock/AlarmActivationViewController.swift +++ b/ProjectClock/AlarmActivationViewController.swift @@ -106,11 +106,13 @@ class AlarmActivationViewController: UIViewController case "Shake": shakeView.show() + // Start motion detection motion.accelerometerUpdateInterval = 0.2 motion.startAccelerometerUpdates(to: OperationQueue.current!) { data, error in if data!.acceleration.x > 5 { ui { self.endAlarm() } + motion.stopAccelerometerUpdates() } } default: