I want to change the shape of the dot to a rounded rectangle which ever tab is selected.
First Image is the current dot style paging:
But I want it to change to 2nd Image kind of:
I want to change the shape of the dot to a rounded rectangle which ever tab is selected.
First Image is the current dot style paging:
But I want it to change to 2nd Image kind of:
2
Answers
Thaks to YouTuber Kavsoft and to his video we know how to do it.
This View allows for some small customisation, you’ll need to get your hand dirty if you want more, of course, and it is only compatible starting from
iOS 17
. Here’s the code:The
clipEdges
Boolean property avoid the animation when reaching the end of the carousel when set to true in case you are wondering.You can use it like this:
Where
colors
is an array of colors:Here’s the result:
If you are looking to support older iOS versions you can check this other video of his.
Let me know your thoughts!
The easiest way to do this is to use the current index. Based on the index, you can adjust the size of the views with the animation you showed us.