I would like to make "here" a button on this note. Anyone could you tell me how to do that. Thank you so much for your answers.
CodePudding user response:
You can create a link in any Text
view using Markdown's standard syntax, e.g.
Text("...For more information refer to [our privacy policy](https://example.org/privacy)")
If your destination is a public URL then that is all you need to do – clicking on it will open the relevant page in Safari.
However, if you want the click to be handled inside your app, you will need to pass the text view a custom OpenURLAction
. See
Here is main part:
Text("All your information are confidential. For more information please refer to [here](conf_info)")
}
.environment(\.openURL, OpenURLAction { url in
if url == URL(string: "conf_info") { // << intercept key
showDetails()
return .handled
}
return .systemAction
})