Thursday, April 11, 2024
HomeiOS Developmentios - UI freezes on faucet of an merchandise inside ScrollView: "Gesture:...

ios – UI freezes on faucet of an merchandise inside ScrollView: “Gesture: System gesture gate timed out.”


I am making an attempt to implement a feed of flash playing cards utilizing SwiftUI.
So I create a ScrollView and populate flash playing cards inside this ScrollView.
My intention is to have the ability to go to the subsequent card by vertical swipe, and flip the cardboard by tapping it.

So I created my VisualFeedView which incorporates the ScrollView and inside this ScrollView I populate my playing cards.

import Basis
import SwiftUI

struct VisualFeedView: View {
    
    @State personal var showingAudioFeed = false
    @StateObject personal var viewModel = VisualFeedViewModel()
    
    var physique: some View {
        ZStack {
            Colour.gliteBackground().ignoresSafeArea()
            ScrollView {
                LazyVStack(spacing: 0) {
                    ForEach(viewModel.currentCards) { card in
                        TwoSidedCardView(content material: card)
                            .containerRelativeFrame([.horizontal, .vertical])
                    }
                }
            }
            .scrollTargetBehavior(.paging)
            .ignoresSafeArea()
            .scrollIndicators(.by no means)
            .onAppear() {
                viewModel.refreshFeed()
            }
            VStack {
                HStack {
                    Spacer()
                    Button {
                        showingAudioFeed.toggle()
                    } label: {
                        ZStack {
                            Circle()
                                .fill(Colour(.sRGB, white: 0, opacity: 0.6))
                                .body(width: 52, peak: 52)
                            Picture("HeadphonesLargeIcon")
                        }
                        
                    }
                    .sheet(isPresented: $showingAudioFeed) {
                        AudioFeedView()
                    }
                    .padding(.trailing, 24.0)
                }
                .padding(.high)
            Spacer()
            }
        }
    }
}

struct VisualFeedView_Previews: PreviewProvider {
    static var previews: some View {
        VisualFeedView()
    }
}

My FlashCard view is the next:

import Basis
import SwiftUI

enum TwoSidedCardViewState {
    case entrance
    case again
}

struct TwoSidedCardView: View {
    var content material: TwoSidedCardContent
    @State personal var frontSide = true

    var physique: some View {
        Group {
            if frontSide {
                CardFrontSideView(content material: content material)
            } else {
                CardBackSideView(content material: content material)
            }
        }
        .clipped()
        .onTapGesture {
            withAnimation {
                frontSide.toggle()
            }
        }
    }
}

struct TwoSidedCardView_Previews: PreviewProvider {
    
    static var previews: some View {
        ZStack {
            Colour.gliteBackground().ignoresSafeArea()
        }
    }
}

What do I do incorrect?

Typically once I faucet on the cardboard the entire UI simply freezes.

Typically once I scroll it – it really works properly, however once I faucet any card it freezes as properly.

Typically I obtain this message within the console ” Gesture: System gesture gate timed out.”

What’s taking place and the way can I debug this straightforward performance?



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments