In iOS 9, is it possible to detect when an app is running in iOS 9\'s Slide Over or Split View mode?
I\'ve tried reading through Apple\'s documentation on iOS 9 mult
Here is a simpler and less fragile way with no constants, that I use in an iPhone/iPad iOS app.
This code also distinguishes between slide over and split view.
I'm returning String values here for clarity, feel free to use enum values and to merge the two cases of fullscreen as suits your app.
func windowMode() -> String {
let screenRect = UIScreen.main.bounds
let appRect = UIApplication.shared.windows[0].bounds
if (UIDevice.current.userInterfaceIdiom == .phone) {
return "iPhone fullscreen"
} else if (screenRect == appRect) {
return "iPad fullscreen"
} else if (appRect.size.height < screenRect.size.height) {
return "iPad slide over"
} else {
return "iPad split view"
}
}