Skip to content

Commit 2ba7889

Browse files
committed
Remove stop since it's semantically different from invalidate.
Allow `start` to take an array of modes.
1 parent 2927287 commit 2ba7889

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

Src/SwiftyTimer.swift

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,12 @@ extension NSTimer {
7878
/// Schedule this timer on the run loop
7979
///
8080
/// By default, the timer is scheduled on the current run loop for the default mode.
81-
/// Specify `runLoop` or `mode` to override these defaults.
81+
/// Specify `runLoop` or `modes` to override these defaults.
8282

83-
public func start(runLoop: NSRunLoop = NSRunLoop.currentRunLoop(), mode: String = NSDefaultRunLoopMode) {
84-
runLoop.addTimer(self, forMode: mode)
85-
}
86-
87-
/// Invalidate this timer (alias to `invalidate`)
88-
89-
public func stop() {
90-
invalidate()
83+
public func start(runLoop: NSRunLoop = NSRunLoop.currentRunLoop(), modes: [String] = [NSDefaultRunLoopMode]) {
84+
for mode in modes {
85+
runLoop.addTimer(self, forMode: mode)
86+
}
9187
}
9288
}
9389

0 commit comments

Comments
 (0)