Example 1: three types of appearance, standard
, compact
, scrollEdge
extension UINavigationController {
override open func viewDidLoad() {
super.viewDidLoad()
let standardAppearance = UINavigationBarAppearance()
standardAppearance.backgroundColor = .red
let compactAppearance = UINavigationBarAppearance()
compactAppearance.backgroundColor = .green
let scrollEdgeAppearance = UINavigationBarAppearance()
scrollEdgeAppearance.backgroundColor = .blue
navigationBar.standardAppearance = standardAppearance
navigationBar.compactAppearance = compactAppearance
navigationBar.scrollEdgeAppearance = scrollEdgeAppearance
}
}