Reputation: 69
Is there a reason as to why the .background modifier on SwiftUI is not changing colors?
I tried restarting Xcode and even creating a new project and I'm still facing the same issue.
Upvotes: 1
Views: 896
Reputation: 257711
By default Rectangle()
has Color.black
opaque foreground color, so any background will be invisible below it.
You can use instead
Rectangle().fill(Color.white)
or
Rectangle().foregroundColor(Color.white)
Upvotes: 1
Reputation: 1320
The background (around the rectangle) is white, try use .fill() instead
Upvotes: 0