@@ -361,23 +361,26 @@ extension LayoutProtocol where Node: UIView {
361
361
// MARK: Stacking
362
362
363
363
/// Stack an array of views in a stack view.
364
- public func stack( _ views: [ AnyLayout ] , axis: NSLayoutConstraint . Axis , spacing: CGFloat = 0 , distribution: UIStackView . Distribution = . fill, alignment: UIStackView . Alignment = . fill) -> Layout < UIStackView > {
365
- return Layout { revertable in
366
- let stackView = UIStackView ( )
367
- stackView. axis = axis
368
- stackView. spacing = spacing
369
- stackView. distribution = distribution
370
- stackView. alignment = alignment
371
- views. forEach { revertable. append ( $0. layout ( in: stackView) ) }
372
- return stackView
373
- }
364
+ public func stack( _ views: [ AnyLayout ] , axis: NSLayoutConstraint . Axis , spacing: CGFloat = 0 , distribution: UIStackView . Distribution = . fill, alignment: UIStackView . Alignment = . fill, configure: @escaping ( UIStackView ) -> Void = { _ in } ) -> Layout < UIStackView > {
365
+ return Layout { revertable in
366
+ let stackView = UIStackView ( )
367
+ stackView. axis = axis
368
+ stackView. spacing = spacing
369
+ stackView. distribution = distribution
370
+ stackView. alignment = alignment
371
+ views. forEach {
372
+ revertable. append ( $0. layout ( in: stackView) )
373
+ }
374
+ configure ( stackView)
375
+ return stackView
376
+ }
374
377
}
375
378
376
379
/// Stack an array of views in a stack view.
377
- public func stack( _ axis: NSLayoutConstraint . Axis , spacing: CGFloat = 0 , distribution: UIStackView . Distribution = . fill, alignment: UIStackView . Alignment = . fill) -> ( ( AnyLayout . . . ) -> Layout < UIStackView > ) {
378
- return { ( views: AnyLayout... ) - > Layout< UIStackView> in
379
- return stack ( views, axis: axis, spacing: spacing, distribution: distribution, alignment: alignment)
380
- }
380
+ public func stack( _ axis: NSLayoutConstraint . Axis , spacing: CGFloat = 0 , distribution: UIStackView . Distribution = . fill, alignment: UIStackView . Alignment = . fill, configure : @escaping ( UIStackView ) -> Void = { _ in } ) -> ( ( AnyLayout . . . ) -> Layout < UIStackView > ) {
381
+ return { ( views: AnyLayout... ) - > Layout< UIStackView> in
382
+ return stack ( views, axis: axis, spacing: spacing, distribution: distribution, alignment: alignment, configure : configure )
383
+ }
381
384
}
382
385
383
386
// MARK: Grouping
0 commit comments