@@ -31,7 +31,7 @@ extension Timer {
3131 /// Create and schedule a timer that will call `block` once after the specified time.
3232
3333 @discardableResult
34- public class func after(_ interval: TimeInterval, _ block: () -> Void) -> Timer {
34+ public class func after(_ interval: TimeInterval, _ block: @escaping () -> Void) -> Timer {
3535 let timer = Timer.new(after: interval, block)
3636 timer.start()
3737 return timer
@@ -40,7 +40,7 @@ extension Timer {
4040 /// Create and schedule a timer that will call `block` repeatedly in specified time intervals.
4141
4242 @discardableResult
43- public class func every(_ interval: TimeInterval, _ block: () -> Void) -> Timer {
43+ public class func every(_ interval: TimeInterval, _ block: @escaping () -> Void) -> Timer {
4444 let timer = Timer.new(every: interval, block)
4545 timer.start()
4646 return timer
@@ -50,7 +50,7 @@ extension Timer {
5050 /// (This variant also passes the timer instance to the block)
5151
5252 @nonobjc @discardableResult
53- public class func every(_ interval: TimeInterval, _ block: (Timer) -> Void) -> Timer {
53+ public class func every(_ interval: TimeInterval, _ block: @escaping (Timer) -> Void) -> Timer {
5454 let timer = Timer.new(every: interval, block)
5555 timer.start()
5656 return timer
@@ -64,7 +64,7 @@ extension Timer {
6464 /// Use `NSTimer.after` to create and schedule a timer in one step.
6565 /// - Note: The `new` class function is a workaround for a crashing bug when using convenience initializers (rdar://18720947)
6666
67- public class func new(after interval: TimeInterval, _ block: () -> Void) -> Timer {
67+ public class func new(after interval: TimeInterval, _ block: @escaping () -> Void) -> Timer {
6868 return CFRunLoopTimerCreateWithHandler(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + interval, 0, 0, 0) { _ in
6969 block()
7070 }
@@ -76,7 +76,7 @@ extension Timer {
7676 /// Use `NSTimer.every` to create and schedule a timer in one step.
7777 /// - Note: The `new` class function is a workaround for a crashing bug when using convenience initializers (rdar://18720947)
7878
79- public class func new(every interval: TimeInterval, _ block: () -> Void) -> Timer {
79+ public class func new(every interval: TimeInterval, _ block: @escaping () -> Void) -> Timer {
8080 return CFRunLoopTimerCreateWithHandler(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + interval, interval, 0, 0) { _ in
8181 block()
8282 }
@@ -89,7 +89,7 @@ extension Timer {
8989 /// Use `NSTimer.every` to create and schedule a timer in one step.
9090 /// - Note: The `new` class function is a workaround for a crashing bug when using convenience initializers (rdar://18720947)
9191
92- @nonobjc public class func new(every interval: TimeInterval, _ block: (Timer) -> Void) -> Timer {
92+ @nonobjc public class func new(every interval: TimeInterval, _ block: @escaping (Timer) -> Void) -> Timer {
9393 var timer: Timer!
9494 timer = CFRunLoopTimerCreateWithHandler(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + interval, interval, 0, 0) { _ in
9595 block(timer)
0 commit comments