I am making an app where I need to use half circle. But I can’t make its frame match the real size of the object. Right now I am trimming the circle but I don’t really know you to actually crop the view.
Here is how I trimming the circle:
Circle()
.trim(from: 0, to: 0.5)
.fill(Color.blue)
.background(Color.red)
And I am getting colour red as background twice bigger the my new object.
2
Answers
It’s probably better to make your own
HalfCircle
that conforms toShape
instead of trying to bashCircle
into the shape you need. Let’s go the extra mile and make it conform toInsettableShape
, in case you want to use it to stroke a border.We can use it to draw this:
using this playground:
You can mask it differently using a
GeometryReader
: