@@ -89,6 +89,7 @@ open class _StackView: _STV, AnyDeclarativeProtocol, DeclarativeProtocolInternal
8989 var __bottom : State < CGFloat > { _bottom }
9090 var __centerX : State < CGFloat > { _centerX }
9191 var __centerY : State < CGFloat > { _centerY }
92+ private var nestedStackViews : [ WeakBox < UStackView > ] = [ ]
9293
9394 open override var tag : Int {
9495 get { properties. tag }
@@ -154,6 +155,9 @@ open class _StackView: _STV, AnyDeclarativeProtocol, DeclarativeProtocolInternal
154155 @discardableResult
155156 public func alignment( _ alignment: UIStackView . Alignment ) -> Self {
156157 self . alignment = alignment
158+ for view in nestedStackViews {
159+ view. underlying? . alignment = alignment
160+ }
157161 return self
158162 }
159163 #endif
@@ -163,14 +167,21 @@ open class _StackView: _STV, AnyDeclarativeProtocol, DeclarativeProtocolInternal
163167 @discardableResult
164168 public func distribution( _ distribution: _STV . Distribution ) -> Self {
165169 self . distribution = distribution
170+
171+ for view in nestedStackViews {
172+ view. underlying? . distribution = distribution
173+ }
166174 return self
167175 }
168-
176+
169177 // Mask: Spacing
170178
171179 @discardableResult
172180 public func spacing( _ spacing: CGFloat ) -> Self {
173181 self . spacing = spacing
182+ for view in nestedStackViews {
183+ view. underlying? . spacing = spacing
184+ }
174185 return self
175186 }
176187
@@ -195,9 +206,7 @@ open class _StackView: _STV, AnyDeclarativeProtocol, DeclarativeProtocolInternal
195206 #else
196207 let stack = UStackView ( ) . axis ( fr. axis ?? axis)
197208 #endif
198- stack. distribution ( distribution)
199- . alignment ( alignment)
200- . spacing ( spacing)
209+ nestedStackViews. append ( WeakBox ( stack) )
201210 fr. allItems ( ) . forEach {
202211 #if os(macOS)
203212 stack. addArrangedSubview ( [ $0 ] . flatten ( fr. orientation ?? orientation) )
0 commit comments