Skip to content

Instantly share code, notes, and snippets.

@c1800054work
Last active June 5, 2022 16:15
Show Gist options
  • Select an option

  • Save c1800054work/a0c1f15a0ea7ce4b1cc4b0dc7d05170c to your computer and use it in GitHub Desktop.

Select an option

Save c1800054work/a0c1f15a0ea7ce4b1cc4b0dc7d05170c to your computer and use it in GitHub Desktop.
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
if #available(iOS 15.0, *){
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = UIColor(red: 0.0/255.0, green: 125/255.0, blue: 0.0/255.0, alpha: 1.0)
appearance.titleTextAttributes = [.foregroundColor: UIColor.white]
UINavigationBar.appearance().tintColor = .white
UINavigationBar.appearance().standardAppearance = appearance
UINavigationBar.appearance().scrollEdgeAppearance = UINavigationBar.appearance().standardAppearance
}else{
UINavigationBar.appearance().barTintColor = UIColor(red: 0.0/255.0, green: 125/255.0, blue: 0.0/255.0, alpha: 1.0)
UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
UINavigationBar.appearance().tintColor = .white
}
//...
return true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment