'Detect if the iPhone device has Safe Area Insets (iPhone X+)

I found the solution to quick detect insets of iPhone. Can anybody test this at Plus devices?

// UIViewController method
// fileprivate var isIphoneX = false
 
open override func viewSafeAreaInsetsDidChange() {
        super.viewSafeAreaInsetsDidChange()
        print("------ his method is called only for iPhone X and Higher ------")
        isIphoneX = true
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source