request) } .map { [weak self] json in let num = json["num"] as! Int if let value = self?.some.value { let new = value + num self?.some.value = new return new } return 0 } .subscribe(onNext: { ... }) .addDisposableTo(disposeBag)
json in json["num"] as! Int } .scan(0) { some, new in new > some ? new : some } .distinctUntilChanged() .subscribe(onNext: { ... }) .addDisposableTo(disposeBag)
json in json["num"] as! Int } .scan(0) { some, new in if new > some { ... return new } return some } .distinctUntilChanged() .subscribe(onNext: { ... }) .addDisposableTo(disposeBag)
in json["num"] as! Int } .distinctUntilChanged { old, new in if (new <= old) == false { ... } return new <= old } .subscribe(onNext: { ... }) .addDisposableTo(disposeBag)