2

I am using SwiftUI to build a native macOS app and when using NavigationSplitView or NavigationStack the navigation/toolbar is always forced to the top. I've tried ZStack, .overlay and even manipulating the NSWindow but it is always still forced to the top.

Basic Example:

import SwiftUI

@main
struct PopOverApp: App {
    @State private var isTopSnackbarPresented = false

    var body: some Scene {
        WindowGroup {
            ContentView()
            .overlay(
                VStack {
                    Rectangle()
                }
                .ignoresSafeArea()
                .background(.blue)
            )
        }
    }
}

struct ContentView: View {

    var body: some View {
        NavigationSplitView {
            Text("Sidebar")
        } detail: {
            Text("Detail")
        }
    }
}

No matter what method I've tried I still end up with the navigation toolbar on top like this:

Paul
  • 189
  • 1
  • 9

0 Answers0