In my IOS application I have a problem with menu when I start changing tabs (for example 20 times) I am getting error Abnormal number of gesture recognizer dependencies: 100. System performance may be affected. Please investigate reducing gesture recognizers and/or their dependencies. This error is because views are stacking and I click on 20 views in one time (I think this is a problem). When I left a button to go back and after open some views I will click “back” every thing is ok, so can I close my view when I go out.
//
// BottomMenu.swift
// SpaceManager
//
// Created by Kuba Kromomołowski on 04/05/2024.
//
import SwiftUI
import Firebase
import FirebaseAuth
struct BottomMenu: View {
@StateObject var logManager = MainViewModel()
@StateObject var mvm = MenuViewModel()
@State var condition1: Bool = true
@State var condition2: Bool = false
@State var condition3: Bool = false
// @StateObject private var cameraViewModel = CameraViewModel()
var body: some View {
HStack{
Group{
Spacer()
BtnMenu(btnText: "Dodaj",
btnIcon: "plus.app.fill",
destinationView:AnyView(LoggedMainView().navigationBarBackButtonHidden(true)),
isActive: condition1
)
Spacer()
BtnMenu(btnText: "Szukaj",
btnIcon: "magnifyingglass",
destinationView:AnyView(SearchView().navigationBarBackButtonHidden(true)),
isActive: condition2
)
Spacer()
BtnMenu(btnText: "Profil",
btnIcon: "person.crop.circle.fill",
destinationView:AnyView(ProfileView().navigationBarBackButtonHidden(true)),
isActive: condition3
)
Spacer()
}.padding(.bottom, 30)
.font(.system(size: 20))
}
}
}
#Preview {
BottomMenu()
}
//
// BtnMenu.swift
// SpaceManager
//
// Created by Kuba Kromomołowski on 04/05/2024.
//
import SwiftUI
struct BtnMenu: View {
var btnText: String
var btnIcon: String
var destinationView: AnyView
@State var isActive: Bool = true
var body: some View {
NavigationLink{
destinationView
} label: {
ZStack {
Text("(Image(systemName: btnIcon)) (btnText)")
}
}.disabled(isActive)
}
}
I tried to left back button and open some views and click back and everything was ok. I change NavigationLink to button but I can change view in this configuration, by I can use self.presentationMode.wrappedValue.dismiss()