The View protocol requires a body property:
public protocol View {
associatedtype Body : View
@ViewBuilder var body: Self.Body { get }
}
Why have some built-in Views in SwiftUI no body?
@frozen public struct EmptyView : View {
@inlinable public init()
public typealias Body = Never
}
@frozen public struct VStack<Content> : View where Content : View {
@inlinable public init(alignment: HorizontalAlignment = .center, spacing: CGFloat? = nil, @ViewBuilder content: () -> Content)
public typealias Body = Never
}
have no body at all..
let emptyView = EmptyView().body
// Value of type 'EmptyView' has no member 'body'
let vStackView = VStack { Text("some text")}.body
// Value of type 'VStack<Text>' has no member 'body'
How are these Views implemented?