I wish to do the following:
import SwiftUI
protocol CombinedView: View {
var dataForViewA: String { get }
var viewA: any View { get }
var viewB: any View { get }
}
extension CombinedView {
var viewA: Text {
Text(dataForViewA)
}
var body: some View {
VStack {
viewA
viewB
}
}
}
viewA works fine because I can specify the concrete type, but var body complains:
Type 'any View' cannot conform to 'View'
I am unsure what I need to implement to solve this. Any ideas?
Thanks in advance for any advice