Coloring the Navigation Bar in Swift

Coloring the Navigation Bar in an iOS app (including the sides of the tab) requires setting an appearance attribute within the init method. It actually only requires a few lines of code, but is a bit unintuitive.

init() {
let colored = UINavigationBarAppearance()
colored.backgroundColor = UIColor(Color.accentColor)
UINavigationBar.appearance().scrollEdgeAppearance = colored
UIBarButtonItem.appearance().tintColor = .white
}

The final line is for setting the text color of the back button. The color of the navigationBarItems can be set by directly setting the foreground color of the Images.