I am trying to set a background image to the navigation bar globally in the App Delegate in Swift. I can get it to work on an individual View Controller like this:
var topBar: UINavigationBar!
topBar.setBackgroundImage(UIImage(named: "navbar"), forBarMetrics:
.Default)
But when I try and add the following to the App Delegate, it crashes with an uncaught exception:
UINavigationBar.appearance().setBackgroundImage(UIImage(named:
"navbar"), forBarMetrics: .Default)