Skip to content

Instantly share code, notes, and snippets.

@SandeepAggarwal
Created November 20, 2021 08:32
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/51fa0c30886c94e2423b478c792c58ad to your computer and use it in GitHub Desktop.
Save SandeepAggarwal/51fa0c30886c94e2423b478c792c58ad to your computer and use it in GitHub Desktop.
StatusBar appearance changes for TabBar in iOS 15 using Xcode 13
override var preferredStatusBarStyle : UIStatusBarStyle {
return .default
}
///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
}
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment