[Solved] How to detect if iPhone is in motion? [closed]

You should look into getting the data from the accelerometer. Here is an example of, how you could retrieve the information. let motionManager = CMMotionManager() if motionManager.isAccelerometerAvailable { let queue = OperationQueue() motionManager.startAccelerometerUpdates(to: queue, withHandler: { data, error in guard let data = data else { return } print(“X = \(data.acceleration.x)”) print(“Y = \(data.acceleration.y)”) print(“Z … Read more