Skip to content

Instantly share code, notes, and snippets.

@bricklife
Created June 10, 2016 02:52
Show Gist options
  • Save bricklife/6cd7b844a278ada0cf1a49279d8bdbe4 to your computer and use it in GitHub Desktop.
Save bricklife/6cd7b844a278ada0cf1a49279d8bdbe4 to your computer and use it in GitHub Desktop.
同じものをRxSwiftで組んでみた。こちらは期待通りの動き。RACのほうはスケジューラ内の仮想時間がadvanceした時刻に即進んじゃうのね #CodePiece
import RxSwift
import RxTests
let scheduler = TestScheduler(initialClock: 0)
Observable<Int>.interval(10, scheduler: scheduler)
.subscribe { _ in print(scheduler.now) }
scheduler.advanceTo(60)
/*
1970-01-01 00:00:10 +0000
1970-01-01 00:00:20 +0000
1970-01-01 00:00:30 +0000
1970-01-01 00:00:40 +0000
1970-01-01 00:00:50 +0000
1970-01-01 00:01:00 +0000
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment