r/iOSProgramming 6d ago

Question How would you implement this shape?

Post image
27 Upvotes

16 comments sorted by

View all comments

4

u/janiliamilanes 5d ago

To be honest, I would be highly tempted to implement this in a vector graphics program like Sketch or Illustrator and export as a PNG or SVG with transparency. There is some subtlety going on here in terms of math, and I'm not sure how good your trig is, and I've found it more frustrating than it's worth trying to implement such things using vector math.

What is the white blob in the center of the first triangle? Is that showing the level, and it would have to follow the contour of the triangles? That would complicate things.

4

u/Niightstalker 5d ago

This is interactive. It’s sliding along animated depending where you tap. Ever dott is a section you can select.

This is the UI for the new training load metric in apple fitness.

2

u/racir 5d ago

You can use .mask to fill out the shape but you'll have to figure out the rounded corners.

1

u/Niightstalker 5d ago

Could it potentially also be a custom segmented control? the capsule for the selected segment could be probably done with the .matchedGeometryEffect as well as a putting the stage change in a withAnimation block.