Skip to content

Instantly share code, notes, and snippets.

@emma-k-alexandra
Created December 7, 2020 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emma-k-alexandra/e7ea42e3a44dda33672cbfcb43f4365b to your computer and use it in GitHub Desktop.
Save emma-k-alexandra/e7ea42e3a44dda33672cbfcb43f4365b to your computer and use it in GitHub Desktop.
enum Content<T: View> {
case text(ContentText)
case link(Link<T>)
}
// A collection of either ContentText or Link views
// This text taken from https://developer.apple.com/documentation/swiftui/link
let content: [Content<Text>] = [
.text(ContentText("As with other views, you can style links using standard view modifiers depending on the view type of the link’s label. For example, a ")),
.link(Link("Text", destination: URL(string: "https://developer.apple.com/documentation/swiftui/text")!)),
.text(ContentText(" label could be modified with a custom ")),
.link(Link("font(_:)", destination: URL(string: "https://developer.apple.com/documentation/swiftui/view/font(_:)")!)),
.text(ContentText(" or ")),
.link(Link("foregroundColor(_:)", destination: URL(string: "https://developer.apple.com/documentation/swiftui/view/foregroundcolor(_:)")!)),
.text(ContentText(" to customize the appearance of the link in your app’s UI."))
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment