Skip to content

Instantly share code, notes, and snippets.

@VAndrJ
Created October 31, 2024 19:46
Show Gist options
  • Save VAndrJ/ac7f0a5352774a29c687263e9221702d to your computer and use it in GitHub Desktop.
Save VAndrJ/ac7f0a5352774a29c687263e9221702d to your computer and use it in GitHub Desktop.
NavigationSplitView issue MRE.
import SwiftUI
@main
struct SplitMREApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
struct ContentView: View {
@State private var columnVisibility: NavigationSplitViewVisibility = .all
var body: some View {
NavigationSplitView(columnVisibility: $columnVisibility) {
Text("Side")
.toolbar {
ToolbarItem {
Text("Example")
}
ToolbarItem {
Button("Detail") {
columnVisibility = .detailOnly
}
}
}
} content: {
Text("Content")
} detail: {
Text("Detail")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment