|
8 | 8 | import UIKit |
9 | 9 |
|
10 | 10 |
|
11 | | -public typealias ArrangedViewsBuilder = ArrayBuilder<UIStackViewElementConvertable> |
| 11 | +public typealias StackViewConfigurationsComposer = ArrayBuilder<UIStackViewConfiguration> |
12 | 12 |
|
13 | 13 |
|
14 | 14 | public extension UIStackView { |
15 | 15 | @discardableResult |
16 | | - func set(@ArrangedViewsBuilder _ elements: () -> [UIStackViewElementConvertable]) -> Self { |
| 16 | + func set(@StackViewConfigurationsComposer _ elements: () -> [UIStackViewConfiguration]) -> Self { |
17 | 17 | set(elements: elements()) |
18 | 18 | return self |
19 | 19 | } |
20 | 20 |
|
21 | 21 | @discardableResult |
22 | | - func append(@ArrangedViewsBuilder _ elements: () -> [UIStackViewElementConvertable]) -> Self { |
| 22 | + func append(@StackViewConfigurationsComposer _ elements: () -> [UIStackViewConfiguration]) -> Self { |
23 | 23 | append(elements: elements()) |
24 | 24 | return self |
25 | 25 | } |
26 | 26 | } |
27 | 27 |
|
28 | 28 | // MARK: - Horizontal |
29 | 29 |
|
30 | | -public func HorizontalStack(_ elements: [UIStackViewElementConvertable]) -> UIStackView { |
| 30 | +public func HorizontalStack(_ elements: [UIStackViewConfiguration]) -> UIStackView { |
31 | 31 | let stack = UIStackView() |
32 | 32 | stack.axis = NSLayoutConstraint.Axis.horizontal |
33 | 33 | stack.append(elements: elements) |
34 | 34 | return stack |
35 | 35 | } |
36 | 36 |
|
37 | | -public func HorizontalStack(@ArrangedViewsBuilder _ elements: () -> [UIStackViewElementConvertable]) -> UIStackView { |
| 37 | +public func HorizontalStack(@StackViewConfigurationsComposer _ elements: () -> [UIStackViewConfiguration]) -> UIStackView { |
38 | 38 | HorizontalStack(elements()) |
39 | 39 | } |
40 | 40 |
|
41 | | -public func TopStack(_ elements: [UIStackViewElementConvertable]) -> UIStackView { |
| 41 | +public func TopStack(_ elements: [UIStackViewConfiguration]) -> UIStackView { |
42 | 42 | let stack = HorizontalStack(elements) |
43 | 43 | stack.alignment = .top |
44 | 44 | return stack |
45 | 45 | } |
46 | 46 |
|
47 | | -public func TopStack(@ArrangedViewsBuilder _ elements: () -> [UIStackViewElementConvertable]) -> UIStackView { |
| 47 | +public func TopStack(@StackViewConfigurationsComposer _ elements: () -> [UIStackViewConfiguration]) -> UIStackView { |
48 | 48 | TopStack(elements()) |
49 | 49 | } |
50 | 50 |
|
51 | | -public func BottomStack(_ elements: [UIStackViewElementConvertable]) -> UIStackView { |
| 51 | +public func BottomStack(_ elements: [UIStackViewConfiguration]) -> UIStackView { |
52 | 52 | let stack = HorizontalStack(elements) |
53 | 53 | stack.alignment = .bottom |
54 | 54 | return stack |
55 | 55 | } |
56 | 56 |
|
57 | | -public func BottomStack(@ArrangedViewsBuilder _ elements: () -> [UIStackViewElementConvertable]) -> UIStackView { |
| 57 | +public func BottomStack(@StackViewConfigurationsComposer _ elements: () -> [UIStackViewConfiguration]) -> UIStackView { |
58 | 58 | BottomStack(elements()) |
59 | 59 | } |
60 | 60 |
|
61 | | -public func HorizontalCenterStack(_ elements: [UIStackViewElementConvertable]) -> UIStackView { |
| 61 | +public func HorizontalCenterStack(_ elements: [UIStackViewConfiguration]) -> UIStackView { |
62 | 62 | let stack = HorizontalStack(elements) |
63 | 63 | stack.alignment = .center |
64 | 64 | return stack |
65 | 65 | } |
66 | 66 |
|
67 | | -public func HorizontalCenterStack(@ArrangedViewsBuilder _ elements: () -> [UIStackViewElementConvertable]) -> UIStackView { |
| 67 | +public func HorizontalCenterStack(@StackViewConfigurationsComposer _ elements: () -> [UIStackViewConfiguration]) -> UIStackView { |
68 | 68 | HorizontalCenterStack(elements()) |
69 | 69 | } |
70 | 70 |
|
71 | 71 | // MARK: - Vertical |
72 | 72 |
|
73 | | -public func VerticalStack(_ elements: [UIStackViewElementConvertable]) -> UIStackView { |
| 73 | +public func VerticalStack(_ elements: [UIStackViewConfiguration]) -> UIStackView { |
74 | 74 | let stack = UIStackView() |
75 | 75 | stack.axis = NSLayoutConstraint.Axis.vertical |
76 | 76 | stack.append(elements: elements) |
77 | 77 | return stack |
78 | 78 | } |
79 | 79 |
|
80 | | -public func VerticalStack(@ArrangedViewsBuilder _ elements: () -> [UIStackViewElementConvertable]) -> UIStackView { |
| 80 | +public func VerticalStack(@StackViewConfigurationsComposer _ elements: () -> [UIStackViewConfiguration]) -> UIStackView { |
81 | 81 | VerticalStack(elements()) |
82 | 82 | } |
83 | 83 |
|
84 | | -public func LeftStack(_ elements: [UIStackViewElementConvertable]) -> UIStackView { |
| 84 | +public func LeftStack(_ elements: [UIStackViewConfiguration]) -> UIStackView { |
85 | 85 | let stack = VerticalStack(elements) |
86 | 86 | stack.alignment = .leading |
87 | 87 | return stack |
88 | 88 | } |
89 | 89 |
|
90 | | -public func LeftStack(@ArrangedViewsBuilder _ elements: () -> [UIStackViewElementConvertable]) -> UIStackView { |
| 90 | +public func LeftStack(@StackViewConfigurationsComposer _ elements: () -> [UIStackViewConfiguration]) -> UIStackView { |
91 | 91 | LeftStack(elements()) |
92 | 92 | } |
93 | 93 |
|
94 | | -public func RightStack(_ elements: [UIStackViewElementConvertable]) -> UIStackView { |
| 94 | +public func RightStack(_ elements: [UIStackViewConfiguration]) -> UIStackView { |
95 | 95 | let stack = VerticalStack(elements) |
96 | 96 | stack.alignment = .trailing |
97 | 97 | return stack |
98 | 98 | } |
99 | 99 |
|
100 | | -public func RightStack(@ArrangedViewsBuilder _ elements: () -> [UIStackViewElementConvertable]) -> UIStackView { |
| 100 | +public func RightStack(@StackViewConfigurationsComposer _ elements: () -> [UIStackViewConfiguration]) -> UIStackView { |
101 | 101 | RightStack(elements()) |
102 | 102 | } |
103 | 103 |
|
104 | | -public func VerticalCenterStack(_ elements: [UIStackViewElementConvertable]) -> UIStackView { |
| 104 | +public func VerticalCenterStack(_ elements: [UIStackViewConfiguration]) -> UIStackView { |
105 | 105 | let stack = VerticalStack(elements) |
106 | 106 | stack.alignment = .center |
107 | 107 | return stack |
108 | 108 | } |
109 | 109 |
|
110 | | -public func VerticalCenterStack(@ArrangedViewsBuilder _ elements: () -> [UIStackViewElementConvertable]) -> UIStackView { |
| 110 | +public func VerticalCenterStack(@StackViewConfigurationsComposer _ elements: () -> [UIStackViewConfiguration]) -> UIStackView { |
111 | 111 | VerticalCenterStack(elements()) |
112 | 112 | } |
0 commit comments