Member-only story
preferredStatusBarStyle not called in swift ?
3 min readJul 12, 2020
As per the Apple doc, UIStatusBarStyle is the style of the device’s status bar. It is a enum type.
Get Started
Now, we can have two types of requirements to set the UIStatusBar style in swift projects.
Use the single type of UIStatusBarStyle for entire project:
There are two steps to set the one common style in an entire project.
- Add ‘View controller-based status bar appearance’ to ‘NO’ in project info.plist
- Select UIStatusBarStyle in Deployment Info of project target.
Use the ViewControllers based UIStatusBarStyle for entire project:
There are two steps to set the ViewControllers based status bar in a project.
- Remove ‘View controller-based status bar appearance’ the key from info.plist because by default it is true or you can add the ‘View controller-based status bar appearance’ to ‘YES’ in info.plist
- Override the statusBarStyle properties in viewControllers.