I found in the latest update of iOS and xCode that onTapGesture isn't consistently registering onTap. Here's a stripped down version of the code I'm using that reproduces this issue. In this case onTap for safari is not working.
I don't reproduce this with iOS13 or if I'm using onLongPress
Has anyone else experienced this in the latest update?
I don't reproduce this with iOS13 or if I'm using onLongPress
Has anyone else experienced this in the latest update?
Code Block @State var runclubs: [RunClubsv2] = [] //Search filter @State var showSearch = false @State private var searchText: String = "" @Binding var showRuns: Bool @State var tap = false @State var showActionSheet = false //States for weeks @State var hideSunday = false @State var hideFavorites = false //View @State var clubInfo = false @State private var urlString = "" @State private var showSafari = false var body: some View { ZStack { VStack { List { //TODO: Add section filtering. HStack { Text("Run Clubs") .font(.title).bold() Spacer() } Section(header: HStack { Text("Sunday") .font(.subheadline) .padding(.vertical, 5) Image(systemName: hideSunday ? "chevron.up": "chevron.down") .foregroundColor(Color("carolinablue")) .rotation3DEffect(Angle(degrees: hideSunday ? 180 : 0), axis: (x: 0, y: 90, z: 0)) } .animation(.easeInOut(duration: 0.2)) .onTapGesture { self.hideSunday.toggle() }) { if hideSunday == false { //display data ForEach(runclubs.filter({ searchText.isEmpty ? true : $0.name.lowercased().contains(searchText.lowercased()) })) { item in if item.category == "Sunday" { ZStack { HStack { //MARK: Background color Color(clubInfo ? "carolinablue" : "card3") .frame(width: 30, height: 575) .cornerRadius(3) .frame(width: 6, height: 75, alignment: .leading) .background(Color( colorLiteral(red: 0, green: 0, blue: 0, alpha: 1)).opacity(0.08)) .cornerRadius(3) .padding() .frame(width: 3, height: 55) .background(Color.black.opacity(0.1)) .cornerRadius(12) .scaleEffect(clubInfo ? 0.8 : 1) .animation(.interpolatingSpring(mass: 1.0,stiffness: 100, damping: 6.0)) //MARK: Runclub top section VStack(alignment: .leading, spacing: 8.0) { HStack { ZStack(alignment: .leading) { Text(item.name) .font(.headline) .animation(.easeOut(duration: 0.4)) .rotation3DEffect(Angle(degrees: clubInfo ? 90 : 0), axis: (x: 90, y: 0, z: 0)) Text(item.location) .font(.headline) .rotation3DEffect(Angle(degrees: clubInfo ? 0 : 90), axis: (x: 90, y: 0, z: 0)) .animation(.easeOut(duration: 0.4)) } Spacer() Image(systemName: clubInfo ? "chevron.up": "chevron.down") .font(.system(size: 20, weight: .medium)) .foregroundColor(Color("carolinablue")) .rotation3DEffect(Angle(degrees: clubInfo ? 180 : 0), axis: (x: 0, y: 90, z: 0)) .shadow(color: Color("carolinablue"), radius: 12, x: 0, y: 0) .onTapGesture{ self.clubInfo.toggle() } } //MARK: Runclub bottom section HStack { ZStack(alignment: .leading) { HStack { Image(systemName: "safari") Text("Link for more Info") .font(.subheadline) .onTapGesture { self.showSafari = true self.urlString = item.link print("urlString \(self.urlString)") } Spacer() } .animation(.easeOut(duration: 0.4)) .rotation3DEffect(Angle(degrees: clubInfo ? 0 : 90), axis: (x: 90, y: 0, z: 0)) // .allowsHitTesting(clubInfo ? true : false) HStack { Text(item.location) .font(.subheadline) .rotation3DEffect(Angle(degrees: clubInfo ? 90 : 0), axis: (x: 90, y: 0, z: 0)) Spacer() // } } .animation(.easeOut(duration: 0.4)) } } //testing long press here to prevent scrolling issues. .onLongPressGesture { self.showSafari = true self.clubInfo = false self.urlString = item.link } } } .sheet(isPresented: $showSafari) { SafariView(urlString: self.$urlString) } .padding(.horizontal, 15) .frame(height: 90) .background(Color(clubInfo ? "background3" : "background2")) .animation(.easeInOut(duration: 0.3)) .clipShape(RoundedRectangle(cornerRadius: 20, style: .continuous)) .shadow(color: Color("background2").opacity(0.8), radius: 10, x: 0, y: 10) .padding(.vertical, 13) } } } } } } .padding(.top, 15) .onTapGesture { self.hideKeyboard() } .navigationBarItems(trailing: EditButton()) } //MARK: Call for run club data .onAppear{ print("onappear making API call for data") Api().getRunClub(url: "https://api.npoint.io/a5a1f2a53b3856ceed34") { (runclubs) in self.runclubs = runclubs print("We got the run run clubs") } } .padding(.top, 65) } }