I’ve received a minimal reproducible instance of DocumentGroup
app utilizing a NavigationSplitView
with a DetailView
. I need to utterly take away the default Navigation Bar inside these views and provide my very own .toolbar
. That is how I achieved this on iOS 18.0-18.3
App.swift
@foremost
struct App: App {
var physique: some Scene {
DocumentGroup(newDocument: BackButtonTestDocument()) { file in
NavigationSplitView {
Record {
NavigationLink("Element View", vacation spot: DetailView())
}
} element: {
DetailView()
}
.toolbar(.hidden, for: .navigationBar)
}
DocumentGroupLaunchScene("Again Button Check") {
Coloration.inexperienced
}
}
}
DetailView.swift
struct DetailView: View {
var physique: some View {
VStack {
Textual content("That is the element view")
}
.navigationBarBackButtonHidden(true)
.toolbar {
LightbulbButton()
}
}
}
LightbulbButton.swift
struct LightbulbButton: ToolbarContent {
var physique: some ToolbarContent {
ToolbarItem(placement: .topBarLeading) {
Button(motion: { print("Tapped") }) {
Label("Lightbulb", systemImage: "lightbulb")
}
}
}
}
This code received me the outcome I wished:
Nonetheless this conduct appears to interrupt on iOS 18.4. I can repair the primary display screen by shifting the .toolbar(.hidden)
modifier up contained in the NavigationSplitView
. However I can not seem to discover a strategy to get .navigationBarBackButonHidden(true)
to work. Or to override the default navigation bar generally
How can I successfully override the default Navigation Bar with a customized button format in iOS 18.4 and onwards?
I’ve tried shifting the navigationBarBackButtonHidden(true)
modifier to a number of locations however this modifier simply does not appear to work in any respect. Even when it did, I might nonetheless be caught with the title and the title bar menu.