An alternative "Form" API for SwiftUI highlighting Swift's new 'ForEach(subviewsOf:)' and 'Group(subViewsOf:)' APIs
further description forthcoming
struct XForm <Content>: View where Content: View {
let content: Content
init(@ViewBuilder content: () -> Content) {
self.content = content()
}
var body: some View {
ScrollView(.vertical) {
VStack {
Group(subviewsOf: content) { subviews in
ForEach(subviews.dropLast()) { subview in
subview
Divider()
}
subviews.last
}
}
.padding([.leading, .trailing])
}
}
}