I'm setting the background image of a large title navigation bar like this:
override func viewDidLoad() {
super.viewDidLoad()
navigationController?.navigationBar.prefersLargeTitles = true
self.title = "Nav bar"
let largeTitleAppearance = UINavigationBarAppearance()
largeTitleAppearance.configureWithOpaqueBackground()
largeTitleAppearance.backgroundImage = UIImage(named: "kunal-shinde--f0YLss50Bs-unsplash")
largeTitleAppearance.backgroundImageContentMode = .scaleAspectFill
largeTitleAppearance.titleTextAttributes = [.foregroundColor: UIColor.white]
largeTitleAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.white]
navigationController?.navigationBar.standardAppearance = largeTitleAppearance
navigationController?.navigationBar.scrollEdgeAppearance = largeTitleAppearance
}
However, the image overflows out of the navigation bar as shown here:

I thought clipsToBounds might work so I set it to true at the end of viewDidLoad
navigationController?.navigationBar.clipsToBounds = true

This is better, but the image does not cover the status bar! How can I get it to cover the status bar while not overflowing?