Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS: Detect if the device is iPhone X family (frameless)

In my app there is some logic for frameless devices (iPhoneX, Xs Xs max, Xr). Currently it works base on the model of the devices, so, I detect the model by DeviceKit framework.

But I want to extend this logic to future frameless devices. Probably in one year we will have some extra frameless devices. So, how can I detect if device is frameless or not? It should cover all current frameless devices and future one.

We can not rely on faceID, safeAreaInset, screen height or size. So, then what?

like image 928
Mark cubn Avatar asked Sep 19 '18 09:09

Mark cubn


People also ask

What is share My Location iPhone?

When Share My Location is turned on, you can share your location with friends, family, and contacts from your iPhone, iPad, or iPod touch with Find My. You can also share your location in the Find People app on watchOS 6 or later with Apple Watch models that have GPS and cellular and are paired with your iPhone.


1 Answers

You could "fitler" for the top notch, something like:

var hasTopNotch: Bool {     if #available(iOS 11.0, tvOS 11.0, *) {         return UIApplication.shared.delegate?.window??.safeAreaInsets.top ?? 0 > 20     }     return false } 
like image 161
Bence Pattogato Avatar answered Sep 19 '22 04:09

Bence Pattogato