Created
June 27, 2019 13:45
-
-
Save chriseidhof/d2fcafb53843df343fe07f3c0dac41d5 to your computer and use it in GitHub Desktop.
LazyView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct LazyView<Content: View>: View { | |
let build: () -> Content | |
init(_ build: @autoclosure @escaping () -> Content) { | |
self.build = build | |
} | |
var body: Content { | |
build() | |
} | |
} |
Thank you very much. It helps a lot!
Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the code, Chris 👍
Here is the relevant discussion: https://twitter.com/chriseidhof/status/1144242544680849410