This is a question for macOS, not iOS.
macOS Monterey on MacBook pro 2021 provides a notch for the first time, which hides parts of the menu when in full screen mode or maximized state. In order to apply a modified menu in that case, I'd like to to detect the notch programmatically.
How can I do this? Didn't find anything in the documentation.
First, check whether you're running on macOS 12 or later, because the APIs are only available on macOS 12 or later. You can use if #available(macOS 12, *) to check.
Then, for the NSScreen of interest, check one of these properties. They should also give the same (yes/no) answer:
safeAreaInsets.top non-zero?auxiliaryTopLeftArea non-nil?auxiliaryTopRightArea non-nil?For example:
extension NSScreen {
var hasTopNotchDesign: Bool {
guard #available(macOS 12, *) else { return false }
return safeAreaInsets.top != 0
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With