Programmatically identify iPhone devices that have a notch or safe area.

Since the iPhone X, Apple has released various sizes of iPhones with a notch.

So, Identifying new iPhones that have a notch or don’t is a new problem for every Apple App Store App Developer. Apple just released in 2020 with iPhone 12, Pro, Pro Max and Mini, which are not similar in screen dimensions to previous generations of iPhone 11.

After reading and surfing the web, I found two helpful articles that will guide you to solve this problem: one post on Stack Overflow and another article by @cafielo.

However, the code shared in both articles above was incompatible with new Apple iOS versions 13 and 14.

So I rewrote those code that may be compatible with Apple iOS 13 and 14 operating system.

Step 01:
First, declare this code as an UIDevice extension in the root of your Swift file, i.e. Public Declaration

extension UIDevice {
    var hasNotch: Bool {
        let keyWindow = {$0.isKeyWindow}.first
        if keyWindow?.safeAreaInsets.bottom ?? 0 > 0 {
            return true
        } else {
            return false

Step 02:
Now use this code to get the boolean answer to identify if the iPhone has Notch or not

if UIDevice.current.hasNotch {
    print("device with notch")

} else {
    print("device without notch")


I hope this tutorial helps you to solve your problem.

Thanks & Regards
Mandar Apte

Published by Mandar Apte

Mandar is a Mumbai-based multi-disciplinary designer with UX/UI, Logo, Symbol, and Brand Identity design expertise. He currently runs his Mudrkashar Linguistic Apple iPhone, iPad, and Mac app business in the heart of Mumbai city.

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.