Skip to content

Instantly share code, notes, and snippets.

@chriseidhof
Created June 27, 2019 13:45
Show Gist options
  • Save chriseidhof/d2fcafb53843df343fe07f3c0dac41d5 to your computer and use it in GitHub Desktop.
Save chriseidhof/d2fcafb53843df343fe07f3c0dac41d5 to your computer and use it in GitHub Desktop.
LazyView
struct LazyView<Content: View>: View {
let build: () -> Content
init(_ build: @autoclosure @escaping () -> Content) {
self.build = build
}
var body: Content {
build()
}
}
@mahmudahsan
Copy link

Thank you very much. It helps a lot!

@ChineseHooper
Copy link

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment