File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,6 +24,17 @@ extension _StackKitViewContentResultBuilderProvider {
2424 public static func buildExpression< T> ( _ expression: StackKitCompatible < T > ) -> [ T ] where T: UIView {
2525 [ expression. view]
2626 }
27+ public static func buildExpression( _ expression: [ UIView ] ) -> [ UIView ] {
28+ expression
29+ }
30+ // parse `for ... in ...`
31+ public static func buildArray( _ components: [ [ UIView ] ] ) -> [ UIView ] {
32+ components. flatMap ( { $0 } )
33+ }
34+ // parse `if #available`
35+ public static func buildLimitedAvailability( _ component: [ UIView ] ) -> [ UIView ] {
36+ component
37+ }
2738}
2839
2940// MARK: For VStack View
@@ -57,6 +68,17 @@ extension _StackKitLayerContentResultBuilder {
5768 public static func buildExpression( _ expression: Void ) -> [ CALayer ] {
5869 [ ]
5970 }
71+ public static func buildExpression( _ expression: [ CALayer ] ) -> [ CALayer ] {
72+ expression
73+ }
74+ // parse `for ... in ...`
75+ public static func buildArray( _ components: [ [ CALayer ] ] ) -> [ CALayer ] {
76+ components. flatMap ( { $0 } )
77+ }
78+ // parse `if #available`
79+ public static func buildLimitedAvailability( _ component: [ CALayer ] ) -> [ CALayer ] {
80+ component
81+ }
6082}
6183
6284@resultBuilder public struct _StackKitVStackLayerContentResultBuilder : _StackKitLayerContentResultBuilder { }
Original file line number Diff line number Diff line change @@ -13,54 +13,66 @@ extension UIView: StackKitCompatibleProvider { }
1313
1414extension StackKitCompatible where Base: UIView {
1515
16+ @discardableResult
1617 public func width( _ value: CGFloat ? ) -> Self {
1718 view. _width = value
1819 return self
1920 }
21+ @discardableResult
2022 public func height( _ value: CGFloat ? ) -> Self {
2123 view. _height = value
2224 return self
2325 }
2426
27+ @discardableResult
2528 public func maxWidth( _ value: CGFloat ? ) -> Self {
2629 view. _maxWidth = value
2730 return self
2831 }
32+ @discardableResult
2933 public func maxHeight( _ value: CGFloat ? ) -> Self {
3034 view. _maxHeight = value
3135 return self
3236 }
37+ @discardableResult
3338 public func minWidth( _ value: CGFloat ? ) -> Self {
3439 view. _minWidth = value
3540 return self
3641 }
42+ @discardableResult
3743 public func minHeight( _ value: CGFloat ? ) -> Self {
3844 view. _minHeight = value
3945 return self
4046 }
4147
48+ @discardableResult
4249 public func size( _ length: CGFloat ) -> Self {
4350 view. _width = length
4451 view. _height = length
4552 return self
4653 }
4754
55+ @discardableResult
4856 public func size( _ width: CGFloat , _ height: CGFloat ) -> Self {
4957 view. _width = width
5058 view. _height = height
5159 return self
5260 }
5361
62+ @discardableResult
5463 public func size( _ size: CGSize ) -> Self {
5564 view. _width = size. width
5665 view. _height = size. height
5766 return self
5867 }
5968
69+ @discardableResult
6070 public func sizeToFit( _ fitType: FitType = . content) -> Self {
6171 view. stackKitFitType = fitType
6272 return self
6373 }
74+
75+ @discardableResult
6476 public func then( _ then: ( Base ) -> Void ) -> Self {
6577 then ( self . view)
6678 return self
You can’t perform that action at this time.
0 commit comments