ios – Button on high of TabView (carousel web page model) — gesture situation


I’ve a ZStack, containing a TabView (web page carousel model) with photographs. On high of that, there’s a button. The button shouldn’t be working (neither of the print statements under output). I feel that is because of the gesture of the tab view overriding the button faucet.

I’ve tried simultaneousGesture after some looking, and in addition tried zIndex, however these haven’t any impact. How can I enable for button faucets, whereas additionally permitting the gesture swipe for the TabView?

ZStack {
    TabView(choice: $selectedPhoto) {
        //photographs
    }
    .tabViewStyle(.web page(indexDisplayMode: .by no means))
    VStack {
        HStack(alignment: .high) {
            Button {
                print("clicked")
            } label: {
                Picture(systemName: "chevron.left")
                    .font(.system(.title3))
                    .foregroundColor(Shade.white)
                    .background(
                        Circle()
                            .fill(Shade.init(hex: "FFFFFF").opacity(0.2))
                            .body(width: 64)
                    )
            }
            .body(width: 64)
            .zIndex(100)
            .simultaneousGesture(TapGesture().onEnded {
                print("additionally clicked")
            })
            Spacer()
        }
        Spacer()
    }
    .padding()
}
.body(top: 300)

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles