Eureka
Eureka copied to clipboard
😠When you create a form with more than 1000 rows. It's very slow.
😠Can I solve it by thread or other ways. Using uitableview directly is not so slow. Thanks.
func generateForm() {
form.removeAll()
form +++ Section()
editSection = Section("Rule".localized())
for rule in rules { //rules count > 10000 will be very slow
insertRule(rule, atIndex: editSection.count)
}
form +++ editSection
}
func insertRule(_ rule: Rule, atIndex index: NSInteger) {
editSection.insert(LabelRow () {
$0.title = rule.rowDescription.0 == nil ? "" : "\(rule.rowDescription.0!)"
$0.value = rule.rowDescription.1 == nil ? "" : "\(rule.rowDescription.1!)"
$0.disabled = Condition(booleanLiteral: !self.editable)
}.cellSetup({ (cell, row) -> () in
cell.accessoryType = .disclosureIndicator
cell.selectionStyle = .default
}).cellUpdate({ (cell, row) -> () in
row.title = rule.rowDescription.0 == nil ? "" : "\(rule.rowDescription.0!)"
row.value = rule.rowDescription.1 == nil ? "" : "\(rule.rowDescription.1!)"
}).onCellSelection({ [unowned self] (cell, row) -> () in
self.showRuleConfiguration(rule)
}),at: index)
}
There are several other issues regarding this (look at the closed ones too). For example #1934
You could try to create the form entirely and then assign it to self.form
in order to avoid updating the UI so many times