iPad NavigationSplitView - Detect if contentView is a slide over

Overview

  • I have a 3 column NavigationSplitView
  • On iPad I would like to detect if the sidebar (red) / content (green) is a slide over
  • I don't want to rely on orientation as it is possible to have multiple apps side by side and that can change the view size

Questions:

  1. On iPad, how can I detect if sidebar (red) / content (green) is a slide over?
  2. Or is there an alternate approach?

Code:

struct ContentView: View {
    @State private var splitViewVisibility = NavigationSplitViewVisibility.automatic
    var body: some View {
        NavigationSplitView(columnVisibility: $splitViewVisibility) {
            Color.red
        } content: {
            Color.green
        } detail: {
            Color.blue
        }
    }
}

Screenshot

Slide over

Not Slide Over

iPad NavigationSplitView - Detect if contentView is a slide over
 
 
Q