I need to detect when the device is in portrait orientation so that I can fire off a special animation. But I do not want my view to autorotate.
How do I override a
In Swift 5.0.
DeviceOrientation vs. ScreenSize vs StatusBar.isLandscape?
If you want to detect changes of orientation in background, and also need to detect face up/down changes, check this link In Swift, how to get the device orientation correctly right after it's launched?
It covers how to correctly detect the orientation in Swift using 3 alternate ways to do it: - viewWillTransitionToSize() - Using Observer - Using the status bar