Skip to content
This repository was archived by the owner on Dec 27, 2020. It is now read-only.

Commit c259fc0

Browse files
authored
add items (#78)
1 parent 6548e52 commit c259fc0

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

GridDemo iOS/ModularGrid/ModularGridView.swift

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,24 @@ struct ModularGridView: View {
1414
self.style
1515
)
1616
.navigationBarTitle("Modular Grid", displayMode: .inline)
17-
.navigationBarItems(trailing:
18-
Button(action: { self.showSettings = true }) {
19-
Image(systemName: "gear")
20-
}
17+
.navigationBarItems(
18+
leading:
19+
Button(action: { self.addMoreItems() }) {
20+
Text("Add items")
21+
},
22+
trailing:
23+
Button(action: { self.showSettings = true }) {
24+
Image(systemName: "gear")
25+
}
2126
)
2227
.sheet(isPresented: $showSettings) {
2328
ModularGridSettingsView(style: self.$style).accentColor(.purple)
2429
}
2530
}
31+
32+
func addMoreItems() {
33+
self.items += (items.count...items.count + 99).map { Item(number: $0) }
34+
}
2635
}
2736

2837
struct ModularGridView_Previews: PreviewProvider {

0 commit comments

Comments
 (0)