Skip to content

Instantly share code, notes, and snippets.

@emma-k-alexandra
Created December 7, 2020 05:27
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/c6bd585ed5549cfef0afac8d641d72df to your computer and use it in GitHub Desktop.
Save emma-k-alexandra/c6bd585ed5549cfef0afac8d641d72df to your computer and use it in GitHub Desktop.
let numberOfViewsInContent: Int
let view: AnyView
// Determine the number of views in the Content at the given index
switch content[index] {
case .text(let text):
numberOfViewsInContent = text.count
view = AnyView(text)
case .link(let link):
numberOfViewsInContent = 1
view = AnyView(link)
}
var numberOfViewsRendered = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment