File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Sources/SwiftCrossUI/Builders Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,10 @@ public struct MenuItemsBuilder {
1313 [ . submenu( first) ]
1414 }
1515
16+ public static func buildPartialBlock( first: Block ) -> [ MenuItem ] {
17+ first. items
18+ }
19+
1620 public static func buildPartialBlock(
1721 accumulated: [ MenuItem ] ,
1822 next: Button
@@ -33,4 +37,29 @@ public struct MenuItemsBuilder {
3337 ) -> [ MenuItem ] {
3438 accumulated + [ . submenu( next) ]
3539 }
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+ }
3665}
You can’t perform that action at this time.
0 commit comments