Files
swift-cli-doc/Sources/CliDoc/BaseNodes/HStack.swift
2024-12-05 07:50:55 -05:00

24 lines
486 B
Swift

public struct HStack: TextNode {
@usableFromInline
let content: [any TextNode]
@usableFromInline
let separator: any TextNode
@inlinable
public init(
spacing: Int = 1,
@TextBuilder content: () -> any TextNode
) {
self.content = array(from: content())
self.separator = seperator(" ", count: spacing > 0 ? spacing - 1 : 0)
}
@inlinable
public var body: some TextNode {
content.removingEmptys()
.joined(separator: separator.render())
}
}