Skip to content

Instantly share code, notes, and snippets.

@HelloCore
Last active June 22, 2017 17:28
Show Gist options
  • Save HelloCore/47879e0b5d0b0954bc92127193c6647d to your computer and use it in GitHub Desktop.
Save HelloCore/47879e0b5d0b0954bc92127193c6647d to your computer and use it in GitHub Desktop.
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