Skip to content

Instantly share code, notes, and snippets.

@thepearl
Last active December 15, 2022 17:07
Show Gist options
  • Save thepearl/8f792059a004d8c45516147da3b7820c to your computer and use it in GitHub Desktop.
Save thepearl/8f792059a004d8c45516147da3b7820c to your computer and use it in GitHub Desktop.
struct CustomView<Content: View>: View {
let content: () -> Content
init(@ViewBuilder content: @escaping () -> Content) {
self.content = content
}
var body: some View {
content()
}
}
// Calling Custom View
CustomView {
VStack {
Text("Hello")
Text("World")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment