{ return Observable.just(.Empty) } // this obviously won't be if username.rangeOfCharacterFromSet(NSCharacterSet.alphanumericCharacterSet().invertedSet) != nil { return Observable.just(.Failed(message: "Username can only contain numbers or digits")) } let loadingValue = ValidationResult.Validating return API .usernameAvailable(username) .map { available in if available { return .OK(message: "Username available") } else { return .Failed(message: "Username already taken") } } .startWith(loadingValue) }