Skip to content

Commit 76973cd

Browse files
committed
Improve item generation.
1 parent 4747102 commit 76973cd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Examples/Example/Example3_TableViewEditing.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,11 @@ struct SectionedTableViewState {
139139
}
140140

141141
extension TableViewEditingCommand {
142+
static var nextNumber = 0
142143
static func addRandomItem() -> TableViewEditingCommand {
143144
let randSection = Int.random(in: 0...2)
144-
let number = Int.random(in: 0...10000)
145+
let number = nextNumber
146+
defer { nextNumber = nextNumber + 1 }
145147
let item = IntItem(number: number, date: Date())
146148
return TableViewEditingCommand.AppendItem(item: item, section: randSection)
147149
}

0 commit comments

Comments
 (0)