Eureka icon indicating copy to clipboard operation
Eureka copied to clipboard

😭 When you create a form with more than 1000 rows. It's very slow.

Open iRemark opened this issue 5 years ago • 1 comments

😭 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)
    }

iRemark avatar Jan 08 '20 03:01 iRemark

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

mats-claassen avatar Jan 08 '20 12:01 mats-claassen