How To Change the Status Bar Color With SwiftUI on a Specific View | by Catalin Patrascu | Mar, 2022

A small hack utilizing ViewModifier in SwiftUI

override var preferredStatusBarStyle: UIStatusBarStyle 

Be certain you’ve the Data.plist configured to permit this. Simply add this line to it:


Let’s create a customized ViewModifier (for extra about it you’ll be able to verify Apple’s documentation hyperlink here) after which apply it to our display screen referred to as MyView:

Simulator display screen for the code above

More Posts