Here’s an example view that does nothing, just to demonstrate how to use @ViewBuilder
.
struct Passthrough<Content>: View where Content: View {
let content: () -> Content
init(@ViewBuilder content: @escaping () -> Content) {
self.content = content
}
var body: some View {
content()
}
}
Usage:
Passthrough {
Text("one")
Text("two")
Text("three")
}