Bug in SwiftUI with .preferredColorScheme() modifier

Found an interesting bug in SwiftUI.

If you use a menu or anything that supports the .preferredColorScheme() modifier in a view right after the navigation bar, you'll get a barely noticeable gray stripe.

How to fix it:

  • Don't use the modifier at all.
  • Use a similar modifier .colorScheme() - but it will soon be removed in new iOS versions, but still works in the current ones.
  • Wait for Apple to fix this bug.
Bug in SwiftUI with .preferredColorScheme() modifier
 
 
Q