I was playing with drawing shapes and got stuck trying to fill and stroke them with different colors.
Both lines 6 and 7 work fine in isolation but, together, they give a compiler error. I understand *why* there's an error - it's because applying either of those lines in isolation changes the type from `Circle` to some other type (`ShapeView<StrokedShape<Circle>, Color>` or `ShapeView<Circle, Color>`) and that other type doesn't support stroking or filling - but I don't think the API should be so counter-intuitive.
More importantly, what *is* the correct way to apply both a stroke color and a fill color to a shape?
import SwiftUI
struct CircleView : View {
var body: some View {
Circle()
.stroke(Color.green, lineWidth: 5)
//.fill(Color.orange)
}
}
#if DEBUG
struct CircleView_Previews : PreviewProvider {
static var previews: some View {
VStack {
CircleView()
.background(Color.primary)
.colorScheme(.light)
CircleView()
.background(Color.primary)
.colorScheme(.dark)
}
}
}
#endif