From 33718976f9d1dc5a4d136993c6b5e5a52bd6b20f Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Wed, 27 Jan 2021 18:32:25 -0500 Subject: [PATCH] [O] Stop motion detection after alarm stopped --- ProjectClock/AlarmActivationViewController.swift | 2 ++ 1 file changed, 2 insertions(+) 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: