Swift – UIDevice orientations using iOS12

In iOS12 Apple introduced a new way to check if your device is in “flat” mode, or better is on your desk.

Let’s take a look at the reference:

https://developer.apple.com/documentation/uikit/uideviceorientation/2981866-isflat

A Boolean value indicating whether the specified orientation is face up or face down.

 

Alberto Pasca

Software engineer @ Pirelli & C. S.p.A. with a strong passion for mobile  development, security, and connected things.