Skip to content

Instantly share code, notes, and snippets.

@SandeepAggarwal
Created November 20, 2021 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SandeepAggarwal/4a8fa76da1722a22c462ffc1b3229fab to your computer and use it in GitHub Desktop.
Save SandeepAggarwal/4a8fa76da1722a22c462ffc1b3229fab to your computer and use it in GitHub Desktop.
Fixes NavBar and TabBar issues on iOS 15 using Xcode 13
func fixiOS15AppearanceIssues() {
fixiOS15NavBarIssues()
fixiOS15TabBarIssues()
}
private func fixiOS15NavBarIssues() {
if #available(iOS 15, *) {
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = .blue //customised nav bar background color
appearance.shadowColor = .clear //removes the nav bar shadow
appearance.titleTextAttributes = [.foregroundColor: UIColor.white]
UINavigationBar.appearance().standardAppearance = appearance
UINavigationBar.appearance().scrollEdgeAppearance = appearance
}
}
private func fixiOS15TabBarIssues() {
if #available(iOS 15, *) {
let appearance = UITabBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = .white
UITabBar.appearance().standardAppearance = appearance
UITabBar.appearance().scrollEdgeAppearance = appearance
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment