My Navigation Bar Changes color after updating to Xcode13.

I am trying to use the solution provided by you but this doesn’t work. Can you please help me ?

  • This is the solution provided by rincewood.

Add a Comment

Replies

Use UINavigationBarAppearance for UINavigationBar styling with iOS 13 and later

Example

if #available(iOS 13.0, *) {
  let appearance = UINavigationBarAppearance()
  appearance.configureWithOpaqueBackground()
  appearance.backgroundColor = .black

  appearance.titleTextAttributes = [
    .foregroundColor: .white,
    .strokeColor: UIColor(red: 131 / 255, green: 125 / 255, blue: 110 / 255, alpha: 1)
  ]

  UINavigationBar.appearance().tintColor = .white
  UINavigationBar.appearance().standardAppearance = appearance
  UINavigationBar.appearance().scrollEdgeAppearance = appearance
}