I have a NavigationView showing a title with the number of records in a List:
.navigationTitle("\(navBarTitle) (\(String(numberOfRecords)))")
In the toolbar I have 2 buttons:
- show Unread - only show unread / show all
- show Favorites - only show favorites / show all
The List view shows either All records, Unread records or Favorite records. Switching between Views using the buttons works fine and updates the navigation title numberOfRecords variable.
All is well sofar. Now...
Rows in the list have a NavigationLink that goes to a detail view:
NavigationLink(destination: detailView(record: record))
In the detail view I have a button: make card favorite. I click the button, but when returning to the list view, the numberOfRecords variable in the navigation title is not updated.
How can I update the navigation title from its detail view?
Thank you!