Last active
September 25, 2017 08:38
-
-
Save StanislavK/0c41ba2899fb58a0518d8d5a7a22d16b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public struct DeviceModel { | |
/// Returns true, if iPhoneX is detected | |
/// Detection is based on the portrait height, see https://developer.apple.com/ios/human-interface-guidelines/overview/iphone-x/ | |
public static var isiPhoneX: Bool = { | |
let iPhoneXPortaitHeight: CGFloat = 812 | |
let currentDevicePortraitHeight: CGFloat = UIScreen.main.fixedCoordinateSpace.bounds.size.height | |
return currentDevicePortraitHeight == iPhoneXPortaitHeight ? true : false | |
}() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment