1

I have a requirement that when user clicks on a button to make a call, I need to send a request to backend to do something. I used Link view to do that, the code is quite simple like this:

Link(destination: URL(string: "tel:110")!, label: {
                    Text("Call 110")
                })

I tried to add modifier of onTapGesture to Text, and this makes the Link not work. And I also tried to add modifier of onOpenUrl to Link, but it doesn't callback either.

I guess there's a solution to use Text instead of Link, and add modifier onTapGesture to call UIApplication.shared.open(theUrl) and then make the remote request.

But I still want to know if there's a way to know the Link is clicked.

Thanks a lot

Xing Da
  • 11
  • 1

0 Answers0