[iOS 26] Can no longer detect whether iPhone has notch

I'm currently using the extension below to determine whether an iPhone has a notch so I can adjust my UI accordingly.

extension UIDevice {
    var hasNotch: Bool {
        if userInterfaceIdiom == .phone, let window = (UIApplication.shared.connectedScenes
            .compactMap { $0 as? UIWindowScene }
            .flatMap { $0.windows }
            .first { $0.isKeyWindow })  {
            return window.safeAreaInsets.bottom > 0
        }
        return false
    }
}

(Adapted from https://stackoverflow.com/questions/73946911/how-to-detect-users-device-has-dynamic-island-in-uikit)

This no longer works in iOS 26, and I have yet to find a similar method that works. Does anyone have any fixes?

Answered by DTS Engineer in 860766022

@wmk We don't recommend you doing this and there's no first-party API that provides support for detecting whether a device has a notch or island.

On which device without notch (or simulator) do you test for iOS 26 ?

Here is how I detect the notch (I test the top):

extension UIDevice {

    var hasNotch: Bool {
            let scenes = UIApplication.shared.connectedScenes
            let windowScene = scenes.first as? UIWindowScene
            guard let window = windowScene?.windows.first else { return false }
            
            return window.safeAreaInsets.top > 20
        }
}

@wmk We don't recommend you doing this and there's no first-party API that provides support for detecting whether a device has a notch or island.

Accepted Answer

Depending on your minimum deployment version, isn't it just the matter of a elimination game with UIDevice.current.name?

import SwiftUI

struct ContentView: View {
    var body: some View {
        VStack {
        	...
        }
		.onAppear(perform: {
			let device = UIDevice.current
			print("1 \(device.name)") // iPhone 16 Pro
			print("2 \(device.systemName)") // iOS
			print("3 \(device.model)") // iPhone
			print("4 \(NSUserName())") // mobile
			print("5 \(device.description)") // <UIDevice: 0x28048dd70>
			//print("6 \(device.model)") // iPhone
		})
        .padding()
    }
}

@Claude31 All devices, physical and simulated. The code I provided consistently doesn't work.

@Tomato I found a workaround involving measuring the screen aspect ratio to determine whether a device is an iPhone SE or not. Not the most elegant solution, but does the job.

Your answer is interesting because I've always assumed that Apple didn't allow developers to access specific information like device name, etc. due to privacy concerns, so it never really occurred to me to just look up the model name and go from there.

This is really useful information to me as it will allow me to tweak UI on a per-device basis, and more. Thank you!

[iOS 26] Can no longer detect whether iPhone has notch
 
 
Q