I have a ForEach loop inside a TabView.
struct PageView: View {
var imageViewModels: [ImageViewModel]
var height: CGFloat
var body: some View {
TabView {
ForEach(imageViewModels) { viewModel in
Image(viewModel.name)
}
}
.frame(width: UIScreen.main.bounds.width, height: height)
.tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))
}
}
My question: Is there a way to loop the images inside the tab view? Ex: If the user swipes right on the first image he goes to the last one. If he swipes left on the last image he goes to the first one.