Last active
June 22, 2017 17:28
-
-
Save HelloCore/47879e0b5d0b0954bc92127193c6647d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let usr = username.rx | |
.text | |
.orEmpty | |
.asObservable() | |
.map { (str)-> Bool in | |
return str.characters.count > 4 | |
} | |
let pwd = password.rx | |
.text | |
.orEmpty | |
.asObservable() | |
.map { (str)-> Bool in | |
return str.characters.count > 4 | |
} | |
Observable | |
.combineLatest(usr,pwd) | |
{ (isValidUsr, isValidPwd) in | |
return isValidUsr && isValidPwd | |
} | |
.bind(to: loginBtn.rx.isEnabled) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment