Skip to content

Instantly share code, notes, and snippets.

@sturdysturge
Last active June 26, 2020 23:27
Show Gist options
  • Save sturdysturge/6b6995f0e3cef6ae844aeedab6017668 to your computer and use it in GitHub Desktop.
Save sturdysturge/6b6995f0e3cef6ae844aeedab6017668 to your computer and use it in GitHub Desktop.
LinkView
struct LinkView: View {
let urlString = "https://medium.com/better-programming/the-complete-swiftui-documentation-youve-been-waiting-for-fdfe7241add9"
var body: some View {
Group {
if let url = URL(string: urlString) {
//The new way to create a Link
Link("Read more", destination: url)
}
else {
EmptyView()
.onAppear { assertionFailure("URL was nil") }
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment