Last active
December 15, 2022 17:07
-
-
Save thepearl/8f792059a004d8c45516147da3b7820c to your computer and use it in GitHub Desktop.
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 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