iOS 15: UINavigationBar background color becomes black

After updating to iOS 15, probably you (like me) noticed some strange colors in your customized UINavigationBar. To fix this you need to add some code which works only in iOS 13 and above:

if #available(iOS 13.0, *) {
    let appearance = UINavigationBarAppearance()
    appearance.backgroundColor =
    navigationBar.standardAppearance = appearance
    navigationBar.scrollEdgeAppearance = navigationBar.standardAppearance

If your app supports only iOS 13 and above, of course you can remove #available check.

Leave a Reply