我搜索过,无法找到解决此特定问题的答案。
我在Swift 4.1中使用Eureka并希望将这些值存储到另一个数组中。
如何获取此处选择的值?
MultivaluedSection(multivaluedOptions: [.Insert, .Delete],
header: "Primary Instrument") {
$0.tag = "instruments"
$0.multivaluedRowToInsertAt = { _ in
ActionSheetRow<String> {
$0.title = "Tap to Select"
$0.options = ["Vocals", "Guitar", "Bass", "Keyboards", "Ukelele"]
}
}
$0 <<< ActionSheetRow<String> {
$0.title = "Tap to Select"
$0.options = ["Vocals", "Guitar", "Bass", "Keyboards", "Ukelele"]
}
}
以下方法不适用于MultivaluedSection:
if let items = self.form.rowBy(tag: "instruments") as? MultivaluedSection
{
print(items.values())
}
答案 0 :(得分:1)
我总是这样做:
let values: [String]? = (form.sectionBy(tag: "instructions")?.flatMap { ($0 as? ActionSheetRow<String>)?.value })
基本上,
ActionSheetRow<String>