Skip to content

Instantly share code, notes, and snippets.

@jumbo-in-Jap
Created August 7, 2017 05:33
Show Gist options
  • Save jumbo-in-Jap/72e6338c16d7e1fc63d83b40b7bce399 to your computer and use it in GitHub Desktop.
Save jumbo-in-Jap/72e6338c16d7e1fc63d83b40b7bce399 to your computer and use it in GitHub Desktop.
再接続処理のタイマー実装
let timer: Observable<Int> = Observable.interval(30.0, scheduler: MainScheduler.instance)
timer
.subscribe(onNext: { (notice) in
// 再接続処理
if self.viewModel.chatStatus.value == LessonViewModel.ChatStatus.DisConnectedWithTutor{
self.viewModel.recallTo()
}
}).addDisposableTo(disposeBag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment