Created
November 20, 2021 08:08
-
-
Save SandeepAggarwal/4a8fa76da1722a22c462ffc1b3229fab to your computer and use it in GitHub Desktop.
Fixes NavBar and TabBar issues on iOS 15 using Xcode 13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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