FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Migrate to Xcode 8 beta 6 by ldiqual · Pull Request #30 · radex/SwiftyTimer · GitHub

This repository was archived by the owner on May 1, 2026. It is now read-only.

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .swift  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
12 changes: 6 additions & 6 deletions Sources/SwiftyTimer.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extension Timer {
/// Create and schedule a timer that will call `block` once after the specified time.

@discardableResult
public class func after(_ interval: TimeInterval, _ block: () -> Void) -> Timer {
public class func after(_ interval: TimeInterval, _ block: @escaping () -> Void) -> Timer {
let timer = Timer.new(after: interval, block)
timer.start()
return timer
Expand All @@ -40,7 +40,7 @@ extension Timer {
/// Create and schedule a timer that will call `block` repeatedly in specified time intervals.

@discardableResult
public class func every(_ interval: TimeInterval, _ block: () -> Void) -> Timer {
public class func every(_ interval: TimeInterval, _ block: @escaping () -> Void) -> Timer {
let timer = Timer.new(every: interval, block)
timer.start()
return timer
Expand All @@ -50,7 +50,7 @@ extension Timer {
/// (This variant also passes the timer instance to the block)

@nonobjc @discardableResult
public class func every(_ interval: TimeInterval, _ block: (Timer) -> Void) -> Timer {
public class func every(_ interval: TimeInterval, _ block: @escaping (Timer) -> Void) -> Timer {
let timer = Timer.new(every: interval, block)
timer.start()
return timer
Expand All @@ -64,7 +64,7 @@ extension Timer {
/// Use `NSTimer.after` to create and schedule a timer in one step.
/// - Note: The `new` class function is a workaround for a crashing bug when using convenience initializers (rdar://18720947)

public class func new(after interval: TimeInterval, _ block: () -> Void) -> Timer {
public class func new(after interval: TimeInterval, _ block: @escaping () -> Void) -> Timer {
return CFRunLoopTimerCreateWithHandler(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + interval, 0, 0, 0) { _ in
block()
}
Expand All @@ -76,7 +76,7 @@ extension Timer {
/// Use `NSTimer.every` to create and schedule a timer in one step.
/// - Note: The `new` class function is a workaround for a crashing bug when using convenience initializers (rdar://18720947)

public class func new(every interval: TimeInterval, _ block: () -> Void) -> Timer {
public class func new(every interval: TimeInterval, _ block: @escaping () -> Void) -> Timer {
return CFRunLoopTimerCreateWithHandler(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + interval, interval, 0, 0) { _ in
block()
}
Expand All @@ -89,7 +89,7 @@ extension Timer {
/// Use `NSTimer.every` to create and schedule a timer in one step.
/// - Note: The `new` class function is a workaround for a crashing bug when using convenience initializers (rdar://18720947)

@nonobjc public class func new(every interval: TimeInterval, _ block: (Timer) -> Void) -> Timer {
@nonobjc public class func new(every interval: TimeInterval, _ block: @escaping (Timer) -> Void) -> Timer {
var timer: Timer!
timer = CFRunLoopTimerCreateWithHandler(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + interval, interval, 0, 0) { _ in
block(timer)
Expand Down
2 changes: 1 addition & 1 deletion SwiftyTimerTests/SwiftyTimerTests/main.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
self.test7()
}

timer.start(runLoop: .current, modes: .defaultRunLoopMode, RunLoopMode(NSEventTrackingRunLoopMode))
timer.start(runLoop: .current, modes: .defaultRunLoopMode, .eventTrackingRunLoopMode)
}

func test7() {
Expand Down

Back | FazBrowse Home | New Git URL