使用Reactive Cocoa swift验证文本字段

时间:2016-11-28 04:44:05

标签: ios swift reactive-cocoa reactive-cocoa-5

我正在尝试验证 Instances: No instances were created because: Can not activate instance of component org.kura.microsoft.simulatedevicesecond.Simulatedevicesecond. The activation throws: java.lang.NoClassDefFoundError: javax/crypto/spec/SecretKeySpec 如果它有超过3个字符,它应该返回true,否则返回false。我尝试使用下面的代码,但它无法正常工作。我做错了什么?

UITextField

1 个答案:

答案 0 :(得分:2)

以下是代码的外观。

let validUserNameSignal =
        self.nameTextField
            .reactive
            .continuousTextValues
            .skipNil()
            .map { $0.characters.count > 3 }

validUserNameSignal.observeValues { value in
    print("user name valid result is \(value)")
}