Created
November 20, 2021 08:32
-
-
Save SandeepAggarwal/51fa0c30886c94e2423b478c792c58ad to your computer and use it in GitHub Desktop.
StatusBar appearance changes for TabBar in 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
override var preferredStatusBarStyle : UIStatusBarStyle { | |
return .default | |
} |
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
///preferredStatusBarStyle was not being called for the individual view controller due to | |
///the container controller(UITabBarController) | |
///not using `childForStatusBarStyle` to decide the status bar style of each of its child vc. | |
///With some changes in iOS 15 in deciding the status bar style | |
///(previously it was deciding it using the `StatusBarStyle` property defined in info. plist), | |
///it is now a requirement to update the `childForStatusBarStyle` property | |
///in UITabBarController subclass | |
///References: https://sanzeevgautam.medium.com/preferredstatusbarstyle-not-called-in-swift-eefae1f10262, | |
///https://stackoverflow.com/a/19513714/3632958 | |
override var childForStatusBarStyle: UIViewController? { | |
return selectedViewController | |
} |
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
override var preferredStatusBarStyle: UIStatusBarStyle { | |
return .lightContent | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment