bibin-jaimon / InterviewKit-iOS

5 stars 0 forks source link

Disable two finger default swipe gesture on TabVIew in SwiftUI #21

Open bibin-jaimon opened 7 months ago

bibin-jaimon commented 7 months ago

On simulator we can swipe using 2 finger by pressing options+shift

https://github.com/bibin-jaimon/InterviewKit-iOS/assets/22428886/05ed8a0e-02b4-44d1-8315-69d71cbe4516

import SwiftUI

struct ContentView: View {
    var body: some View {
        TabView {
            Page1()
                .gesture(DragGesture())
            Page2()
                .gesture(DragGesture())
        }

        .tabViewStyle(.page)
    }
}

struct Page1: View {
    var body: some View {
        VStack {

        }
        .frame(maxWidth: .infinity, maxHeight: .infinity)
        .background(.red)
    }
}
struct Page2: View {
    var body: some View {
        VStack {

        }
        .frame(maxWidth: .infinity, maxHeight: .infinity)
        .background(.green)
    }
}

#Preview {
    ContentView()
}
bibin-jaimon commented 7 months ago

https://stackoverflow.com/a/78248453/4591087