Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
SwiftUI .onTapGesture always higher priority than .swipeActions

How do I make my the code in .swipeActions be called instead of the one in .onTapGesture?

I have a SwiftUI view like follows:

struct ContentView: View {
    
    var body: some View {
        VStack {
            List {
                Text("Hello, World!")
                    .swipeActions {
                        Button(role: .destructive) {
                            print("Tapped Delete button")
                        } label: {
                            Label("Delete", systemImage: "trash")
                        }
                    }
            }
        }
        .padding()
        .onTapGesture {
            print("Tapped VStack")
        }
    }
}

This produces an output like this:

enter image description here

You can see, that only the code inside of .onTapGesture is called. The code inside of .swipeActions is never called. How can I change the priority, so that the code inside of .swipeActions functions correctly?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!