david-swift 8eeda083e9
All checks were successful
Deploy Docs / publish (push) Successful in 18m28s
SwiftLint / SwiftLint (push) Successful in 5s
Separate AnyView extensions from widgets
2024-10-16 14:22:34 +02:00

35 lines
800 B
Swift

//
// HStack.swift
// Adwaita
//
// Created by david-swift on 26.09.23.
//
/// A horizontal GtkBox equivalent.
public struct HStack: SimpleView {
/// The content.
var content: () -> Body
/// Whether the linked style should be used.
var linked = false
/// The view's body.
public var view: Body {
ModifierWrapper(content: VStack(horizontal: true, content: content), style: "linked", styleActive: linked)
}
/// Initialize a `HStack`.
/// - Parameter content: The view content.
public init(@ViewBuilder content: @escaping () -> Body) {
self.content = content
}
/// Link the children.
public func linked(_ active: Bool = true) -> Self {
var newSelf = self
newSelf.linked = active
return newSelf
}
}