I'm trying to customise the design for XS Max. Previously I just identified the device by checking the main.bound.screen.height, which, for XS Max, according to this site: https://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions, should return 896.0, right?
The Xcode 10.0 XS Max simulator returns 812.0 as screen height (the same goes for XR, which should have the same screen points), though. Any idea how to fix this?
enum IPhone: String {
case SE, normal, plus, X, XSMax
init?(height: CGFloat) {
switch height {
case 568: self = .SE
case 667: self = .normal
case 736: self = .plus
case 812: self = .X
case 896: self = .XSMax
default:
return nil
}
}
}
struct Design {
static var iPhone = IPhone(height: UIScreen.main.bounds.height)!
}
In the viewDidLoad() of the view controller:
print("screen height: \(UIScreen.main.bounds.height), iPhone: \(Design.iPhone.rawValue)")