After Updating my app to iOS 17.0 I noticed some odd behavior when swiping a detail view away with a parent view that has a toolbar with a ToolbarItem(placement: .bottomBar).
As the user starts a leading swipe gesture to navigate back to the previous view the parent navigation title strangely animates to the center and the leading nav bar button disappears. If the user stops this gesture at any point before completing the swipe they will be stuck in the detail view as the leading nav button has disappeared. This only seems to be an issue if one attempts to swipe back to the parent view and not when the leading nav button is tapped.
The following is the minimum code to reproduce this issue for me. I am testing on a physical device on iOS 17.0 with Xcode Version 15.0 (15A240d).
struct ToolbarIssueView: View {
var body: some View {
NavigationStack {
NavigationLink {
Text("Detail View")
.navigationTitle("Detail")
} label: {
Text("To Detail View")
}
.toolbar {
// This seems to cause strange behavior
ToolbarItem(placement: .bottomBar) {
Text("Bottom Bar Content")
}
}
.navigationTitle("Main")
}
}
}
I understand that this bottom bar could easily be replaced with a .safeAreaInset(edges: .bottom) but I would prefer to use the more standard ToolbarItem(placement: .bottomBar).
If anyone has any fixes for this issue or know what I am missing I would love to hear it!