I was reading code in the SwiftUI framework and I don't understand what's the meaning/role of the type alias at line 65692 here:
Could you please explain? Thank you!
It's the view being modified. I.e. Content
is input, Body
is output.
https://developer.apple.com/documentation/swiftui/viewmodifier/content
1 Like
So it needs to distinguish between Body and Content, because even known they both conform to View
protocol if the signature had been func body(Cotent:) -> Cotent
, the method would have been obligated to return the very same type of View? While obviously a modifier might change that?
Hope I'm getting it right.
You might find this explanation of Content
helpful.
In short the rhs of that typealias is missing as it refers to a public type which is prefixed by an underscore and therefore also hidden from us.
typealias Content = SwiftUI._ViewModifier_Content<Self>
2 Likes