How can I detect if my device is an iPhoneX in Swift 4? [duplicate]
This question already has an answer here: Detect if the device is iPhone X 34 answers I am sure there is a better, more proper way to do this. But right now I am using UIScreen.main.bounds to detect if I am dealing with an iPhone X (812 tall) or not. This specific app is landscape only, btw. So this is what I have in this function where I am crating slides for a slide view: func setupSlideViews(slideView: [SlideView]) { let screenSize = UIScreen.main.bounds var frame: CGRect! if screenSize.width == 812 { frame = scrollView.frame } else { frame = view.frame } scrollView.frame = frame scrollView