Pushing new view using navigation link while using the searchbar crashes the app without any logs

ContentView:

List(jobs) { job in 
  NavigationLink(detination: DetailsView(job)) {
    ...
  }
}
.searchable(...)

DetailsView:

List {
   ...
}
.toolbar(ToolBarItem(...))

When I click on the NavigationLink to go to DetailsView, the detail view glitches out quite badly and the entire app becomes unresponsive, before crashing. I isolated the problem and realised it is caused by either having the ToolBarItem in DetailsView or having the List view present in DetailsView.

Really odd bug, doesn't happen when search bar is not in use and does not happen in the Xcode Simulator either.

Would really appreciate if anyone can verify or have a workaround!

Make you submit this to https://feedbackassistant.apple.com/

I just got the same behaviour. Did you solve the issue, or sent a feedback? and if you did, did you get any response?

Also, it seems like these causes the issue:

  • a textfield should be focused while navigating
  • destination should have a List and toolbar

I also created a minimal reproducible example:

FB10041732 sent

You cannot view other people's bug reports on Apple's Feedback Assistant, so the inclusion of this identifier is pointless.

It’s extremely valuable for any Apple employee to view and help triage, so they should always be posted. They’re also useful to help post a duplicate and point back to the original so Apple gets some idea of priority.

4 Likes

Not pointless because it shows that at least a feedback has been submitted on this issue.
Max

1 Like

Potential Fix
Use ToolbarItemGroup. However it only works properly when you use more than one button. Of course you can use a blank button for the second item.

Example:

ToolbarItemGroup(placement: .navigationBarTrailing) {
                Button("") {}
                
                Button {

                } label: {
                    Image(systemName: "play.fill")
                }
            }