On macOS 12.4, when calling UIDevice.current.userInterfaceIdiom
from Mac Catalyst, it returns .iPadOS
when the Scale Interface to Match iPad
setting is enabled:
However, if this setting is changed to "Optimize Interface for Mac," then UIDevice.current.userInterfaceIdiom
works correctly on macOS.
Is this the expected behavior?
This is the expected behavior from the documentation: https://developer.apple.com/documentation/apple-silicon/adapting-ios-code-to-run-in-the-macos-environment?preferredLanguage=occ
On macOS, the UITraitCollection and UIDevice classes report the following iOS idiom types instead of UIUserInterfaceIdiom.mac