I've created a custom view which is basically a VStack with modifiers applied to it. But unlike the original VStack view, I have to use a grouping view when I'm using it with multiple subviews.
How can I get rid of the "Group" in the below example?
import SwiftUI
struct ContentView: View {
var body: some View {
CustomGroup() {
Group {
Text("Hello")
Text("World")
}
}
}
}
struct CustomGroup<Content>: View where Content : View {
let content: () -> Content
var body: some View {
VStack() {
content()
}
.background(Color.yellow)
.cornerRadius(8)
}
}