How to create cover-flow with swiftui without using external api

423 views Asked by At

How I could create a Cover flow with SwiftUI TabView without using any external dependency.

Like this image

enter image description here

     TabView(selection: self.$pg.index){
        ForEach(0 ..< 5) {item in
            FruitCardView(fruit: fruitsData[item])
        }
        
    }.tabViewStyle(PageTabViewStyle(indexDisplayMode: .always))
    .edgesIgnoringSafeArea(.leading)
    .padding(.vertical, 20)

How I want to display it :

enter image description here Thanks in advance

1

There are 1 answers

7
Taeeun Kim On

You can use Tabview.

TabView {
    ForEach(pages) { page in
        Text(page.name)
    }
    .frame(width: 200, height: 200)
}
.tabViewStyle(PageTabViewStyle())

https://developer.apple.com/documentation/swiftui/tabview