How to create tappable url/phone number in SwiftUI

前端 未结 6 1311
Happy的楠姐
Happy的楠姐 2021-01-04 10:06

I would like to display a phone number in a SwiftUI Text (or any View), and then make it clickable so that it will open the \'Phone\'.

Is there a way to do this with

6条回答
  •  孤城傲影
    2021-01-04 11:02

    KISS answer:

    Button("url") {UIApplication.shared.open(URL(string: "https://google.com")!)}
    

提交回复
热议问题