Skip to content

bmoliveira/RxTimer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

eab8204 Â· Jan 17, 2019

History

22 Commits
Jan 17, 2019
Jan 17, 2019
Jan 17, 2019
Jan 17, 2019
Jan 17, 2019
Jan 17, 2019
Aug 2, 2016
Jan 17, 2019
Jan 17, 2019
Jan 17, 2019
Jan 17, 2019

Repository files navigation

RxTimer

RxTimer provides an easy to use RxSwift binding for NSTimer.

Usage

1 second default timer

NSTimer.rx_timer
  .subscribeNext { _ in
    print("timer triggered")
  }
  .addDisposableTo(disposeBag)

Any number of seconds

NSTimer.rx.timer(10)
  .subscribeNext { _ in
    print("timer triggered")
  }
  .addDisposableTo(disposeBag)

Skip first event to ignore trigger upon subscribing

NSTimer.rx.timer(10)
  .skip(1)
  .subscribeNext { _ in
    print("timer triggered")
  }
  .addDisposableTo(disposeBag)

Take(n) to cancel the timer after n number of calls

NSTimer.rx.timer(10)
  .take(10)
  .subscribeNext { _ in
    print("timer triggered")
  }
  .addDisposableTo(disposeBag)

Installing

CocoaPods

pod 'RxTimer'

Carthage

Cartfile

github "bmoliveira/RxTimer" ~> 1.3

And that'll be 👌

License

MIT License.