© Wallace Wang 2019
Wallace WangPro iPhone Development with Swift 5https://doi.org/10.1007/978-1-4842-4944-4_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 helping you measure angles.

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 devices also include a gyroscope to detect positions of the iOS device. By ...

Get Pro iPhone Development with Swift 5: 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.