0

I am looking for a way to change the status bar color (time/service/battery) at the top of the screen based on a @State variable. I am using state to change different themes in my app. Some themes have a gray menu bar at the top and one has a black menu bar. When I switch to the black menu bar I can no longer see the status bar. Is there a way I can change that in my view based on the state? The app is written in SwiftUI and I am using a custom view modifier to change the styling based on state.

zaniad
  • 1

1 Answers1

0

Check this thread. Or if you feel lazy you can achieve the same result by playing around with the appearences in the colors in your Assets.xcassets with the help of .preferredColorScheme(_:)

Visal Rajapakse
  • 1,718
  • 1
  • 9
  • 15
  • I looked through that thread but from what I can tell those set the color as either black or white. I need it to change and adapt based on the state. If I set the `.preferredColorScheme(_:)` it changes the whole app to dark mode which I do not want. I am just trying to change the font color from black to white in the status bar. – zaniad Jun 30 '21 at 20:32