From accentColor(_:)
,
The color to use as an accent color. If
nil
, the accent color continues to be inherited
Sounds like a bug (unless they mean inherit from the system).
In the mean time, you can do:
extension View {
@ViewBuilder
func conditional(accentColor: Color?) -> some View {
if let color = color {
self.accentColor(accentColor)
} else {
self
}
}
}
...
.conditional(accentColor:
condition1 ? color1 :
condition2 ? color2 :
nil
)