0

In SwiftUI I need the statusbar content to be dark (time, battery) in the main view. But then in the detail view I need the make the statusbar content white without any background color, only the background image I specified for the view is behind it.

The ideal way would be to use .toolbarColorScheme and do this as shown here:

.toolbarColorScheme(.dark, for: .navigationBar) .toolbarBackground(Color.white.opacity(0), for: .navigationBar)

or:

.toolbarColorScheme(.dark, for: .navigationBar) .toolbarBackground(.hidden, for: .navigationBar)

However, both don't work and all I can achieve is in the image below. .toolbarColorScheme with a .dark value always automatically has a dark colored material background or a visible background color and can't be used without it. Is there any way to still use it and remove the dark background? (for instance with introspect)

enter image description here

After trying many different other ways, none of them worked while keeping the transition animations between the main and detail view intact. I also can't use .preferredColorScheme because then I can't make the smooth transitions work.

Florian
  • 107
  • 1
  • 8

0 Answers0