How To Change the Status Bar Color With SwiftUI on a Specific View

A small hack using ViewModifier in SwiftUI

Catalin Patrascu
Better Programming
Published in
2 min readMar 10, 2022

--

Source: undraw.co

Remember the good old days in UIKit when it was quite simple to change the status bar color just by using this code on a specific UIViewController?

override var preferredStatusBarStyle: UIStatusBarStyle {
.lightContent
}

--

--

iOS Engineer • Mobile Technologist 👨‍💻 Writes about building scalable & testable iOS apps