如何使用 Eureka 制作两个互斥的分段行

How to make two mutually exclusive segmented rows with Eureka

我使用 Eureka library 并且我想使用以下代码制作两个互斥的分段行:

        <<< SegmentedRow<String>("weight1") { row in
            row.options = ["До 3 кг", "До 5 кг"]
            row.value = "До 3 кг"
        }.onChange{ [weak self] row in
            let weight2Row: SegmentedRow<String>! = self?.form.rowByTag("weight2")
            weight2Row.value = nil
        }

        <<< SegmentedRow<String>("weight2") { row in
            row.options = ["До 16 кг", "У меня авто"]
        }.onChange{ [weak self] row in
            let weight1Row: SegmentedRow<String>! = self?.form.rowByTag("weight1")
            weight1Row.value = nil
        }

但是如果我点击第二个分段行,第一个分段控件不会清除选择

如指南中所述 - 第 How to set the form values using a dictionary

部分

If the form was already displayed we have to reload the visible rows either by reloading the table view tableView.reloadData() or invoking updateCell() to each visible row.

所以只需调用 weight2Row.updateCell() 即可反映新值。