Reputation: 55
I have a TabView with PageTabViewStyle as the tabViewStyle on it inside the TabView are multiple views and it works perfectly fine but I want it to start from the right then continue to the left like the first view starts from the right then swipe to the left to see the second view.
Your help is much appreciated.
Upvotes: 1
Views: 869
Reputation: 1256
you can use this way for that.
selectedTab
struct ContentView: View {
// put the tag number of the last page
@State private var selectedTab = 2
var body: some View {
VStack {
TabView(selection: $selectedTab){
Text("First Page")
.tag(0)
Text("Second Page")
.tag(1)
Text("Third Page")
.tag(2)
}
.frame(width: 300, height: 500)
.tabViewStyle(PageTabViewStyle())
.background(Color.purple)
.cornerRadius(15)
}
}
}
Upvotes: 2