Fix iOS 15 nav bar appearance

This commit is contained in:
Justin Mazzocchi 2022-05-05 20:29:24 -07:00
parent 5ff2d41d7c
commit ea16391639

View file

@ -27,6 +27,8 @@ extension AppDelegate: UIApplicationDelegate {
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
self.application = application self.application = application
configureGlobalAppearance()
return true return true
} }
@ -40,3 +42,16 @@ extension AppDelegate: UIApplicationDelegate {
deviceTokenSubject.send(completion: .failure(error)) deviceTokenSubject.send(completion: .failure(error))
} }
} }
private extension AppDelegate {
func configureGlobalAppearance() {
if #available(iOS 15, *) {
let appearance = UINavigationBarAppearance()
appearance.configureWithDefaultBackground()
UINavigationBar.appearance().standardAppearance = appearance
UINavigationBar.appearance().scrollEdgeAppearance = appearance
}
}
}