I tried to override SwiftUI.View.body and add some test code, so I'd like to try using @_implements to redirect "var body: some View" to a custom protocol, but it looks like @_implements doesn't support get only properties?
I can find @_implements in the Swift source code for functions, and for type alias, but not for get only properties.
@_implements itself doesn't report an error, but the compiler gives me this error.
protocol TestableView {
associatedtype Body: View
var body: Body { get }
}
struct TestView: View, TestableView { // Type 'TestView' does not conform to protocol 'View'
// Type 'TestView' does not conform to protocol 'TestableView'
@_implements(SwiftUI.View, body)
@ViewBuilder
var testBody: some View {
body
}
@_implements(TestableView, body)
@ViewBuilder
var body: some View {
...
}
}