O'Reilly logo
  • LIANG LIANG thinks this is interesting:

var isValid : Observable <Bool> {
return Observable.combineLatest(username.asObservable(), password.asObservable()){ usernameString, passwordString in
usernameString.characters.count >= 4 passwordString.characters.count >= 4
}
}

From

Cover of Reactive Programming with Swift 4

Note

Wrong in the code for Swift 4:

var isValid : Observable <Bool> {
return Observable.combineLatest(username.asObservable(), password.asObservable()){ (usernameString, passwordString) -> Bool in
if(usernameString.characters.count >= 4 && passwordString.characters.count >= 4) {
return true
}
else {
return false
}
}
}