For customizing the navigation bar in the navigator view, I used
That's not a horrible way to do it. It certainly gets the job done.
Depending on what you are trying to accomplish there are a couple ways you could access the navigation bar.
One note: You are force-unwrapping
navigationController. If you decide to do this you just need to make sure that view controller will always live inside a
UINavigationControllerand in its
viewDidLoadmethod do any sort of customization in there. Then instead of creating a navigation controller like this
UINavigationController.init(rootViewController: someViewController), you would use your subclass of
For #2 you would want to create a new class and put the code in that new class