SwiftUI sheet accentColor

I use the .accentColor() modifier to apply a color to the entire application. At some point this method no longer seems to work with a sheet, where Color.accentColor returns the default blue color. It used to work, so I don't know what the reason is. Any solutions?

The accentColor(_:) modifier is marked as being deprecated with a message saying this:

Use the asset catalog’s accent color or tint(_:) instead.

Using either of these methods will result in a sheet using this accent colour.


If you still want to use accentColor(_:), just reapply this modifier to the sheet content, as a workaround.

SwiftUI sheet accentColor
 
 
Q