Skip to content

Commit

Permalink
Merge branch 'release/0.5.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
malcommac committed Jul 18, 2018
2 parents a1851b7 + 3efa2e2 commit 4a7f321
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Repeat.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Repeat"
s.version = "0.5.5"
s.version = "0.5.6"
s.summary = "Modern NSTimer alternative in Swift"
s.description = <<-DESC
Repeat is a modern alternative to NSTimer; no strong references, multiple observers, reusable instances with start/stop/pause support in swifty syntax.
Expand Down
10 changes: 5 additions & 5 deletions Sources/Repeat/Repeater.swift
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ open class Repeater: Equatable {
/// - observer: handler to call when timer fires.
/// - Returns: timer instance
@discardableResult
public class func once(after interval: Interval, queue: DispatchQueue? = nil, _ observer: @escaping Observer) -> Repeater {
let timer = Repeater(interval: interval, mode: .once, queue: queue, observer: observer)
public class func once(after interval: Interval, tolerance: DispatchTimeInterval = .nanoseconds(0), queue: DispatchQueue? = nil, _ observer: @escaping Observer) -> Repeater {
let timer = Repeater(interval: interval, mode: .once, tolerance: tolerance, queue: queue, observer: observer)
timer.start()
return timer
}
Expand All @@ -294,9 +294,9 @@ open class Repeater: Equatable {
/// - handler: handler to call on fire
/// - Returns: timer
@discardableResult
public class func every(_ interval: Interval, count: Int? = nil, queue: DispatchQueue? = nil, _ handler: @escaping Observer) -> Repeater {
public class func every(_ interval: Interval, count: Int? = nil, tolerance: DispatchTimeInterval = .nanoseconds(0), queue: DispatchQueue? = nil, _ handler: @escaping Observer) -> Repeater {
let mode: Mode = (count != nil ? .finite(count!) : .infinite)
let timer = Repeater(interval: interval, mode: mode, queue: queue, observer: handler)
let timer = Repeater(interval: interval, mode: mode, tolerance: tolerance, queue: queue, observer: handler)
timer.start()
return timer
}
Expand Down Expand Up @@ -396,7 +396,7 @@ open class Repeater: Equatable {
if case .finite = self.mode {
self.remainingIterations! -= 1
}

// dispatch to observers
self.observers.values.forEach { $0(self) }

Expand Down

0 comments on commit 4a7f321

Please sign in to comment.