SwiftUI - how do customise navigation bar on one screen only?

Viewed 578

At WWDC, one talk gave an example of how the ‘Reminders’ app customises the Navigation Bar on different screens. They shared how they did this:

let appearance = navigationBar.standardAppearance.copy()
navigationItem.standardAppearance = appearance

How would the actual implementation work? I’m not quite sure where that code slots in, in order to customise one navigation bar.

Any help would be super appreciated!

1 Answers

In viewWillAppear set this value

UINavigationBar.appearance().titleTextAttributes = [ NSFontAttributeName: UIFont(name: "MuseoSans-500", size: 19)!, NSForegroundColorAttributeName: UIColor.black ]

and on viewWillDisappear reset all the values.

Related