How to detect whether targetEnvironment is iPadOS in SwiftUI?
I use this in my code: private var idiom : UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom } private var isPortrait : Bool { UIDevice.current.orientation.isPortrait } Then you can do this: var body: some View { NavigationView { masterView() if isPortrait { portraitDetailView() } else { landscapeDetailView() } } } private func portraitDetailView() -> some View { if idiom … Read more