I am trying to create a TabView with pagination where the middle view is always overlapped when swiping to the next view, left or right. Not exactly sure if this is possible with SwiftUI?
struct ContentView: View {
@State private var selection = 0
var body: some View {
ZStack {
TabView(selection: $selection) {
Text("Left View")
.tabItem {
Image(systemName: "1.icon")
Text("Left")
}
.tag(0)
// Middle View should always be overlapped
Text("Middle View")
.tabItem {
Image(systemName: "2.icon")
Text("Middle View")
}
.tag(1)
Text("Right View")
.tabItem {
Image(systemName: "3.icon")
Text("Right")
}
.tag(2)
}
.tabViewStyle(PageTabViewStyle())
}
}
}