How to achieve the Rotary type Carousel present in the iCarousel Framework of swift. The following is what I wanted to achieve with the SwiftUI
I checked many tutorials and the framework present but I could not able to achieve as shown above image
How to achieve the Rotary type Carousel present in the iCarousel Framework of swift. The following is what I wanted to achieve with the SwiftUI
I checked many tutorials and the framework present but I could not able to achieve as shown above image
2
Answers
Here is a general approach: All items are drawn above each other in a
ZStack
, then their position and opacity is changed based on the "distance" to the foremost element.The demo has a fixed size for the item, but can easily be adapted. Change the values in
opacity
andscaleEffect
to your wishes.Thank you @ChrisR this is a great way to achieve Carousel experience.
Added active index in the @ChrisR‘s answer, that might be useful for someone.
@ChrisR once you add active index in your answer, I can remove my post.