27 lines
438 B
Swift
27 lines
438 B
Swift
// swiftlint:disable type_name
|
|
public protocol Node: NodeRepresentable {
|
|
associatedtype _Body: NodeRepresentable
|
|
typealias Body = _Body
|
|
|
|
@NodeBuilder
|
|
var body: Body { get }
|
|
}
|
|
|
|
// swiftlint:enable type_name
|
|
|
|
public extension Node {
|
|
@inlinable
|
|
func render() -> String {
|
|
body.render()
|
|
}
|
|
}
|
|
|
|
public struct Foo: Node {
|
|
|
|
public init() {}
|
|
|
|
public var body: some NodeRepresentable {
|
|
LabeledContent("Foo") { "Bar" }
|
|
}
|
|
}
|