TIL you can detect whether the targetEnvironment is iPadOS in SwiftUI with the following code:
extension UIDevice {
static var isIPad: Bool {
UIDevice.current.userInterfaceIdiom == .pad
}
static var isIPhone: Bool {
UIDevice.current.userInterfaceIdiom == .phone
}
}
Here’s the Stack Overflow comment I got this code from.