struct TitleTextFormatView<Content: View>: View {
var content: Content
var body: some View {
content
.font(.title)
.foregroundColor(.red)
}
}
// Error:
// Type '() -> VStack<TupleView<(Text, Text)>>' cannot conform to 'View'
TitleTextFormatView {
VStack {
Text("top")
Text("bottom")
}
}
【SwiftUI】 今日のなんでやねん - @ViewBuilder
👉 https://android.benigumo.com/20240222/viewbuilder/