Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift Eureka表单-使用变量创建.hidden谓词_Swift_Eureka Forms - Fatal编程技术网

Swift Eureka表单-使用变量创建.hidden谓词

Swift Eureka表单-使用变量创建.hidden谓词,swift,eureka-forms,Swift,Eureka Forms,我试图在Eureka中创建一对分段行,第二行取决于第一行中选择的单元格 通过构建文档中的“隐藏行”示例,并通过硬编码我的值,我成功地做到了这一点。 以下是行规范的外观: import UIKit import Eureka class ViewController: FormViewController { override func viewDidLoad() { super.viewDidLoad() form +++ Section("") <

我试图在Eureka中创建一对分段行,第二行取决于第一行中选择的单元格

通过构建文档中的“隐藏行”示例,并通过硬编码我的值,我成功地做到了这一点。 以下是行规范的外观:

import UIKit
import Eureka

class ViewController: FormViewController {
    override func viewDidLoad() {
    super.viewDidLoad()
    form +++ Section("")
        <<< SegmentedRow<String>("firstChoice"){
            $0.selectorTitle = "firstChoice"
            $0.options = ["One","Two","Three"]
            $0.value = "One"
        }
        <<< SegmentedRow<String>("One"){ 
            $0.hidden = "$firstChoice != 'One'" //Row is hidden unless first choice is "One"
            $0.selectorTitle = "One"
            $0.options = ["1-1","1-2","1-3"]
            $0.value = "1-1"
        }
        <<< SegmentedRow<String>("Two"){ 
            $0.hidden = "$firstChoice != 'Two'" //Row is hidden unless first choice is "Two"
            $0.selectorTitle = "Two"
            $0.options = ["2-1","2-2","2-3"]
            $0.value = "2-1"
        }
        <<< SegmentedRow<String>("Three"){ 
            $0.hidden = "$firstChoice != 'Three'" //Row is hidden unless first choice is "Three"
            $0.selectorTitle = "Three"
            $0.options = ["3-1","3-2","3-3"]
            $0.value = "3-1"
        }
    }
}
这可以生成,但在运行时我得到以下错误:

2017-05-21 07:41:27.547 EurekaTest[74681:12894860] *** NSForwarding: warning: object 0x7fa248e15f50 of class '_TtGC6Eureka12SegmentedRowSS_' does not implement methodSignatureForSelector: -- trouble ahead
Unrecognized selector -[_TtGC6Eureka12SegmentedRowSS_ valueForKey:]
我假设
ChoiceOne[0]
不能作为字符串正确地传递给谓词生成器,但我对swift和这个构造的理解还不够,无法找到一条捷径

此外,我希望以后能够循环数组的大小,以构建一个可变大小的segmentedRow


感谢您的帮助

可以使用隐藏节

$0.hidden=.function([“firstChoice”],{form->Bool-in
let row:RowOf!=form.rowBy(标记:“第一选择”)
返回row.value!=self.ChoiceOne[0]
})

您可以使用隐藏节

$0.hidden=.function([“firstChoice”],{form->Bool-in
let row:RowOf!=form.rowBy(标记:“第一选择”)
返回row.value!=self.ChoiceOne[0]
})
2017-05-21 07:41:27.547 EurekaTest[74681:12894860] *** NSForwarding: warning: object 0x7fa248e15f50 of class '_TtGC6Eureka12SegmentedRowSS_' does not implement methodSignatureForSelector: -- trouble ahead
Unrecognized selector -[_TtGC6Eureka12SegmentedRowSS_ valueForKey:]
    $0.hidden = .function(["firstChoice"], { form -> Bool in
                    let row: RowOf<String>! = form.rowBy(tag: "firstChoice")
                    return row.value != self. ChoiceOne[0]
                })