© Molly Maskrey and Wallace Wang 2018

Molly Maskrey and Wallace Wang, Pro iPhone Development with Swift 4, https://doi.org/10.1007/978-1-4842-3381-8_5

5. Device Orientation and Motion

Molly Maskrey and Wallace Wang2

(1)Parker, Colorado, USA

(2)San Diego, California, USA

The iPhone, iPad, and iPod touch all include a built-in accelerometer — the tiny device that lets iOS know how the device is being held and if it’s being moved. iOS uses the accelerometer to handle autorotation, and many games use it as a control mechanism. The accelerometer can also be used to detect shakes and other sudden movement. This capability was extended even further with the introduction of the iPhone 4, which was the first iPhone to include a built-in gyroscope to let developers ...

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