Skip to content

Instantly share code, notes, and snippets.

@SandeepAggarwal
Last active November 20, 2021 08:33
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/fa617c926251e482968b5859336b5e26 to your computer and use it in GitHub Desktop.
Save SandeepAggarwal/fa617c926251e482968b5859336b5e26 to your computer and use it in GitHub Desktop.
StatusBar appearance changes for NavBar Controller in iOS 15 using Xcode 13
override var preferredStatusBarStyle : UIStatusBarStyle {
return .default
}
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
///preferredStatusBarStyle was not being called for the individual view controller due to
///the container controller(UINavigationController)
///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 UINavigationController subclass
///References: https://sanzeevgautam.medium.com/preferredstatusbarstyle-not-called-in-swift-eefae1f10262,
///https://stackoverflow.com/a/19513714/3632958
override var childForStatusBarStyle: UIViewController? {
visibleViewController
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment