How to detect notch screen in swift

Joon Won Lee
2 min readOct 19, 2018
Image from Apple release page.

On September 2018, Apple launched their three new iPhones. The latest iPhones are termed as iPhone Xs, Xs max and Xr.

Before the new devices, iPhoneX is the only device has notch in the screen. So, Any product which consider notch in app had to update UI for those new area.

There are many way to find notch in iOS. One that I heard many times from co-workers(iOS Developer) is just find a iPhoneX model. You can use many ways to find iPhoneX and I’ve used screen size to find iPhoneX device.

But, the way I used faces some problem to detect notch in app. Because all those new devices(iPhone Xs, Xs max and Xr) have a notch and have different screen size.

After read some apple documents, I found out that there is a another good way to find notch in screen. That is using safeArea.

Take a look at follow images….

https://medium.com/rosberryapps/ios-safe-area-ca10e919526f
https://medium.com/rosberryapps/ios-safe-area-ca10e919526f

Tada… this is the way to I found out.

Both orientation, notch devices has safeArea bottom inset greater than 0.

I hope you enjoy this article and give a comment any feedback on this.

Thanks

--

--