© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
W. WangPro iPhone Development with SwiftUIhttps://doi.org/10.1007/978-1-4842-7827-7_10

10. Detecting Motion and Orientation

Wallace Wang1  
(1)
San Diego, CA, USA
 

Mobile computer devices like the iPhone and iPad essentially put a PC in your pocket, letting you use a computer wherever you happen to be. However, unlike a desktop or even a laptop PC, mobile computers can track movement and orientation. This can come in handy for tracking the user’s arm movements in a game or measure angles in objects around you.

To track motion and orientation, every iOS device comes with a built-in accelerometer that can detect movement. In addition to the accelerometer, the iOS ...

Get Pro iPhone Development with SwiftUI: Design and Manage Top Quality Apps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.