File tree 1 file changed +29
-0
lines changed
Sources/SwiftCrossUI/Builders
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ public struct MenuItemsBuilder {
13
13
[ . submenu( first) ]
14
14
}
15
15
16
+ public static func buildPartialBlock( first: Block ) -> [ MenuItem ] {
17
+ first. items
18
+ }
19
+
16
20
public static func buildPartialBlock(
17
21
accumulated: [ MenuItem ] ,
18
22
next: Button
@@ -33,4 +37,29 @@ public struct MenuItemsBuilder {
33
37
) -> [ MenuItem ] {
34
38
accumulated + [ . submenu( next) ]
35
39
}
40
+
41
+ public static func buildPartialBlock(
42
+ accumulated: [ MenuItem ] ,
43
+ next: Block
44
+ ) -> [ MenuItem ] {
45
+ accumulated + next. items
46
+ }
47
+
48
+ public static func buildOptional( _ component: [ MenuItem ] ? ) -> Block {
49
+ Block ( items: component ?? [ ] )
50
+ }
51
+
52
+ public static func buildEither( first component: [ MenuItem ] ) -> Block {
53
+ Block ( items: component)
54
+ }
55
+
56
+ public static func buildEither( second component: [ MenuItem ] ) -> Block {
57
+ Block ( items: component)
58
+ }
59
+
60
+ /// An implementation detail of ``MenuItemBuilder``'s support for
61
+ /// `if`/`else if`/`else` blocks.
62
+ public struct Block {
63
+ var items : [ MenuItem ]
64
+ }
36
65
}
You can’t perform that action at this time.
0 commit comments