Skip to content

nunoonun/RxTimer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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'

And that'll be 👌

License

MIT License.

About

RxTimer adds RxSwift Timer bindings.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 60.9%
  • Ruby 39.1%