Former
Former copied to clipboard
Remove crash
Crash If remove all rows from section:
section.remove(rowFormers: section.rowFormers)
because it method is incorrect:
`public func remove(rowFormers: [RowFormer]) -> Self {
var removedCount = 0
for (index, rowFormer) in self.rowFormers.enumerated() {
if rowFormers.contains(where: { $0 === rowFormer }) {
remove(atIndex: index) //REMOVE INSIDE CYCLE, COUNT OF ELEMENTS CHANGED EVERY ITERATION
removedCount += 1
if removedCount >= rowFormers.count {
return self
}
}
}
return self
}`
It's right:
` public func remove(rowFormers: [RowFormer]) -> Self {
for rowFormer in rowFormers {
if let index = self.rowFormers.index(where: {$0 === rowFormer}) {
remove(atIndex: index)
}
}
return self
}
`
Thank for reporting
Looking into this