Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions Classes/Views/Universal/StackView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ open class _StackView: _STV, AnyDeclarativeProtocol, DeclarativeProtocolInternal
var __bottom: State<CGFloat> { _bottom }
var __centerX: State<CGFloat> { _centerX }
var __centerY: State<CGFloat> { _centerY }
private var nestedStackViews: [WeakBox<UStackView>] = []

open override var tag: Int {
get { properties.tag }
Expand Down Expand Up @@ -154,6 +155,9 @@ open class _StackView: _STV, AnyDeclarativeProtocol, DeclarativeProtocolInternal
@discardableResult
public func alignment(_ alignment: UIStackView.Alignment) -> Self {
self.alignment = alignment
for view in nestedStackViews {
view.underlying?.alignment = alignment
}
return self
}
#endif
Expand All @@ -163,14 +167,21 @@ open class _StackView: _STV, AnyDeclarativeProtocol, DeclarativeProtocolInternal
@discardableResult
public func distribution(_ distribution: _STV.Distribution) -> Self {
self.distribution = distribution

for view in nestedStackViews {
view.underlying?.distribution = distribution
}
return self
}

// Mask: Spacing

@discardableResult
public func spacing(_ spacing: CGFloat) -> Self {
self.spacing = spacing
for view in nestedStackViews {
view.underlying?.spacing = spacing
}
return self
}

Expand All @@ -195,9 +206,7 @@ open class _StackView: _STV, AnyDeclarativeProtocol, DeclarativeProtocolInternal
#else
let stack = UStackView().axis(fr.axis ?? axis)
#endif
stack.distribution(distribution)
.alignment(alignment)
.spacing(spacing)
nestedStackViews.append(WeakBox(stack))
fr.allItems().forEach {
#if os(macOS)
stack.addArrangedSubview([$0].flatten(fr.orientation ?? orientation))
Expand Down