I\'m trying to add a mask to two shapes such that the second shape masks out the first shape. If I do something like Circle().mask(Circle().offset(…)), this has
If you are after something like this:
Then you can just put the two shapes in a ZStack and give the masking one the color of a background:
struct MaskView: View {
@Environment(\.colorScheme) var colorScheme: ColorScheme
var body: some View {
ZStack {
Circle()
.fill(Color.yellow)
Circle()
.fill(colorScheme == .dark ? Color.black : Color.white)
.offset(x: 150.0, y: 10.0)
}
}
}