UINavigation Bar background image
Making the UINavigation bar have a background image of your choice is easy with two lines of code. I have setup a XCode project with a simple navigation controller as the root view controller of the default view. It looks like:

First of all we have added the following gummi_bear_navbar to our assets.xcassets for the background image we will be using in this tutorial.


Now to change the navigation bar image simply use the following code:
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let navBackgroundImage = UIImage(named: "gummi_bear_navbar") // Get our image
self.navigationController!.navigationBar.setBackgroundImage(navBackgroundImage, for: .default) // Set the Nav Bar Image
}
Now your navigation bar will have a background image as follows:



