How can I add a custom container view in SwiftUI
SwiftUI
implements this with the ViewBuilder
@functionBuilder
struct HGrid <Content: View>: View {
init(@ViewBuilder builder: () -> Content) {
let content = builder()
...
}
}
See also
- https://forums.swift.org/t/function-builders/25167
- https://github.com/apple/swift-evolution/pull/1046