SwiftUI TabView vs ScrollView for Infinite Horizontal Carousel with Page Control
Hi all,
I am trying to create an infinite horizontal carousel with page control. After the last page the scrollview should show the first page and vice versa while scrolling backwards. Most of the posts I see are using a TabView, instead of a ScrollView for this purpose.
1. Is TabView a better option for this use case?
2. What are the benefits of using TabView vs ScrollView?
I implemented it using a TabView and it seems to be easy that way. Added duplicates of last and first elements to the array. Can we only achieve this functionality by adding those duplicates or are there other ways of doing it?
0 Replies