Skip to content

Instantly share code, notes, and snippets.

@Exey
Created March 24, 2020 18:58
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 Exey/19f4d72284e4b83fdb8cfb20415bfda5 to your computer and use it in GitHub Desktop.
Save Exey/19f4d72284e4b83fdb8cfb20415bfda5 to your computer and use it in GitHub Desktop.
import SwiftUI
private struct LazyView<Content: View>: View {
let build: () -> Content
init(_ build: @autoclosure @escaping () -> Content) {
self.build = build
}
var body: Content {
build()
}
}
extension View {
var lazy: some View {
LazyView(self)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment