I have the following example code:
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
NavigationLink(destination: DetailViewToolbarBug()) {
Text("Unknown")
}
}
}
}
struct DetailViewToolbarBug: View {
@State private var showActionSheet = false
var body: some View {
VStack {
NavigationLink(destination: DetailViewToolbarBug()) {
Text("Unknown")
}
}
.actionSheet(isPresented: $showActionSheet) {
ActionSheet(title: Text("Optionen"),
buttons: [
.default(Text("Add"), action: {
})
])
}
.navigationBarTitle("Detail")
.toolbar {
ToolbarItem(placement: .primaryAction) {
Button(action: {
showActionSheet = true
}) {
Image(systemName: "ellipsis.circle")
}
}
}
}
}
The issue: If you navigate in two or more times and then open the action sheet, the back button (will have the name Detail in it) will disappear and not come back again.
How to solve this?