| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,31 +24,31 @@ | |||
| 24 | 24 | ||
| 25 | 25 | import Foundation | |
| 26 | 26 | ||
| 27 | - extension NSTimer { | ||
| 27 | + extension Timer { | ||
| 28 | 28 | ||
| 29 | 29 | // MARK: Schedule timers | |
| 30 | 30 | ||
| 31 | 31 | /// Create and schedule a timer that will call `block` once after the specified time. | |
| 32 | 32 | ||
| 33 | - public class func after(interval: NSTimeInterval, _ block: () -> Void) -> NSTimer { | ||
| 34 | - let timer = NSTimer.new(after: interval, block) | ||
| 33 | + public class func after(_ interval: TimeInterval, _ block: () -> Void) -> Timer { | ||
| 34 | + let timer = Timer.new(after: interval, block) | ||
| 35 | 35 | timer.start() | |
| 36 | 36 | return timer | |
| 37 | 37 | } | |
| 38 | 38 | ||
| 39 | 39 | /// Create and schedule a timer that will call `block` repeatedly in specified time intervals. | |
| 40 | 40 | ||
| 41 | - public class func every(interval: NSTimeInterval, _ block: () -> Void) -> NSTimer { | ||
| 42 | - let timer = NSTimer.new(every: interval, block) | ||
| 41 | + public class func every(_ interval: TimeInterval, _ block: () -> Void) -> Timer { | ||
| 42 | + let timer = Timer.new(every: interval, block) | ||
| 43 | 43 | timer.start() | |
| 44 | 44 | return timer | |
| 45 | 45 | } | |
| 46 | 46 | ||
| 47 | 47 | /// Create and schedule a timer that will call `block` repeatedly in specified time intervals. | |
| 48 | 48 | /// (This variant also passes the timer instance to the block) | |
| 49 | 49 | ||
| 50 | - @nonobjc public class func every(interval: NSTimeInterval, _ block: NSTimer -> Void) -> NSTimer { | ||
| 51 | - let timer = NSTimer.new(every: interval, block) | ||
| 50 | + @nonobjc public class func every(_ interval: TimeInterval, _ block: (Timer) -> Void) -> Timer { | ||
| 51 | + let timer = Timer.new(every: interval, block) | ||
| 52 | 52 | timer.start() | |
| 53 | 53 | return timer | |
| 54 | 54 | } | |
@@ -61,7 +61,7 @@ extension NSTimer { | |||
| 61 | 61 | /// Use `NSTimer.after` to create and schedule a timer in one step. | |
| 62 | 62 | /// - Note: The `new` class function is a workaround for a crashing bug when using convenience initializers (rdar://18720947) | |
| 63 | 63 | ||
| 64 | - public class func new(after interval: NSTimeInterval, _ block: () -> Void) -> NSTimer { | ||
| 64 | + public class func new(after interval: TimeInterval, _ block: () -> Void) -> Timer { | ||
| 65 | 65 | return CFRunLoopTimerCreateWithHandler(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + interval, 0, 0, 0) { _ in | |
| 66 | 66 | block() | |
| 67 | 67 | } | |
@@ -73,7 +73,7 @@ extension NSTimer { | |||
| 73 | 73 | /// Use `NSTimer.every` to create and schedule a timer in one step. | |
| 74 | 74 | /// - Note: The `new` class function is a workaround for a crashing bug when using convenience initializers (rdar://18720947) | |
| 75 | 75 | ||
| 76 | - public class func new(every interval: NSTimeInterval, _ block: () -> Void) -> NSTimer { | ||
| 76 | + public class func new(every interval: TimeInterval, _ block: () -> Void) -> Timer { | ||
| 77 | 77 | return CFRunLoopTimerCreateWithHandler(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + interval, interval, 0, 0) { _ in | |
| 78 | 78 | block() | |
| 79 | 79 | } | |
@@ -86,8 +86,8 @@ extension NSTimer { | |||
| 86 | 86 | /// Use `NSTimer.every` to create and schedule a timer in one step. | |
| 87 | 87 | /// - Note: The `new` class function is a workaround for a crashing bug when using convenience initializers (rdar://18720947) | |
| 88 | 88 | ||
| 89 | - @nonobjc public class func new(every interval: NSTimeInterval, _ block: NSTimer -> Void) -> NSTimer { | ||
| 90 | - var timer: NSTimer! | ||
| 89 | + @nonobjc public class func new(every interval: TimeInterval, _ block: (Timer) -> Void) -> Timer { | ||
| 90 | + var timer: Timer! | ||
| 91 | 91 | timer = CFRunLoopTimerCreateWithHandler(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + interval, interval, 0, 0) { _ in | |
| 92 | 92 | block(timer) | |
| 93 | 93 | } | |
@@ -101,31 +101,31 @@ extension NSTimer { | |||
| 101 | 101 | /// By default, the timer is scheduled on the current run loop for the default mode. | |
| 102 | 102 | /// Specify `runLoop` or `modes` to override these defaults. | |
| 103 | 103 | ||
| 104 | - public func start(runLoop runLoop: NSRunLoop = NSRunLoop.currentRunLoop(), modes: String...) { | ||
| 105 | - let modes = modes.isEmpty ? [NSDefaultRunLoopMode] : modes | ||
| 104 | + public func start(runLoop: RunLoop = RunLoop.current, modes: RunLoopMode...) { | ||
| 105 | + let modes = modes.isEmpty ? [RunLoopMode.defaultRunLoopMode] : modes | ||
| 106 | 106 | ||
| 107 | 107 | for mode in modes { | |
| 108 | - runLoop.addTimer(self, forMode: mode) | ||
| 108 | + runLoop.add(self, forMode: mode) | ||
| 109 | 109 | } | |
| 110 | 110 | } | |
| 111 | 111 | } | |
| 112 | 112 | ||
| 113 | 113 | // MARK: - Time extensions | |
| 114 | 114 | ||
| 115 | 115 | extension Double { | |
| 116 | - public var millisecond: NSTimeInterval { return self / 1000 } | ||
| 117 | - public var milliseconds: NSTimeInterval { return self / 1000 } | ||
| 118 | - public var ms: NSTimeInterval { return self / 1000 } | ||
| 116 | + public var millisecond: TimeInterval { return self / 1000 } | ||
| 117 | + public var milliseconds: TimeInterval { return self / 1000 } | ||
| 118 | + public var ms: TimeInterval { return self / 1000 } | ||
| 119 | 119 | ||
| 120 | - public var second: NSTimeInterval { return self } | ||
| 121 | - public var seconds: NSTimeInterval { return self } | ||
| 120 | + public var second: TimeInterval { return self } | ||
| 121 | + public var seconds: TimeInterval { return self } | ||
| 122 | 122 | ||
| 123 | - public var minute: NSTimeInterval { return self * 60 } | ||
| 124 | - public var minutes: NSTimeInterval { return self * 60 } | ||
| 123 | + public var minute: TimeInterval { return self * 60 } | ||
| 124 | + public var minutes: TimeInterval { return self * 60 } | ||
| 125 | 125 | ||
| 126 | - public var hour: NSTimeInterval { return self * 3600 } | ||
| 127 | - public var hours: NSTimeInterval { return self * 3600 } | ||
| 126 | + public var hour: TimeInterval { return self * 3600 } | ||
| 127 | + public var hours: TimeInterval { return self * 3600 } | ||
| 128 | 128 | ||
| 129 | - public var day: NSTimeInterval { return self * 3600 * 24 } | ||
| 130 | - public var days: NSTimeInterval { return self * 3600 * 24 } | ||
| 129 | + public var day: TimeInterval { return self * 3600 * 24 } | ||
| 130 | + public var days: TimeInterval { return self * 3600 * 24 } | ||
| 131 | 131 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -205,11 +205,12 @@ | |||
| 205 | 205 | 3E721AB21BF7255C008AF027 /* Project object */ = { | |
| 206 | 206 | isa = PBXProject; | |
| 207 | 207 | attributes = { | |
| 208 | - LastUpgradeCheck = 0710; | ||
| 208 | + LastUpgradeCheck = 0800; | ||
| 209 | 209 | ORGANIZATIONNAME = "Radosław Pietruszewski"; | |
| 210 | 210 | TargetAttributes = { | |
| 211 | 211 | 3E721ABA1BF7255D008AF027 = { | |
| 212 | 212 | CreatedOnToolsVersion = 7.1; | |
| 213 | + LastSwiftMigration = 0800; | ||
| 213 | 214 | }; | |
| 214 | 215 | 6E7E40891C84B1A20030CEBB = { | |
| 215 | 216 | CreatedOnToolsVersion = 7.2; | |
@@ -417,6 +418,7 @@ | |||
| 417 | 418 | PRODUCT_NAME = "$(TARGET_NAME)"; | |
| 418 | 419 | SKIP_INSTALL = YES; | |
| 419 | 420 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; | |
| 421 | + SWIFT_VERSION = 3.0; | ||
| 420 | 422 | }; | |
| 421 | 423 | name = Debug; | |
| 422 | 424 | }; | |
@@ -436,6 +438,8 @@ | |||
| 436 | 438 | PRODUCT_BUNDLE_IDENTIFIER = io.radex.SwiftyTimer; | |
| 437 | 439 | PRODUCT_NAME = "$(TARGET_NAME)"; | |
| 438 | 440 | SKIP_INSTALL = YES; | |
| 441 | + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; | ||
| 442 | + SWIFT_VERSION = 3.0; | ||
| 439 | 443 | }; | |
| 440 | 444 | name = Release; | |
| 441 | 445 | }; | |
@@ -480,6 +484,7 @@ | |||
| 480 | 484 | PRODUCT_NAME = SwiftyTimer; | |
| 481 | 485 | SDKROOT = macosx; | |
| 482 | 486 | SKIP_INSTALL = YES; | |
| 487 | + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; | ||
| 483 | 488 | }; | |
| 484 | 489 | name = Release; | |
| 485 | 490 | }; | |
@@ -518,6 +523,7 @@ | |||
| 518 | 523 | PRODUCT_NAME = SwiftyTimer; | |
| 519 | 524 | SDKROOT = appletvos; | |
| 520 | 525 | SKIP_INSTALL = YES; | |
| 526 | + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; | ||
| 521 | 527 | TARGETED_DEVICE_FAMILY = 3; | |
| 522 | 528 | TVOS_DEPLOYMENT_TARGET = 9.0; | |
| 523 | 529 | }; | |
@@ -558,6 +564,7 @@ | |||
| 558 | 564 | PRODUCT_NAME = SwiftyTimer; | |
| 559 | 565 | SDKROOT = watchos; | |
| 560 | 566 | SKIP_INSTALL = YES; | |
| 567 | + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; | ||
| 561 | 568 | TARGETED_DEVICE_FAMILY = 4; | |
| 562 | 569 | WATCHOS_DEPLOYMENT_TARGET = 2.0; | |
| 563 | 570 | }; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> | |
| 2 | 2 | <Scheme | |
| 3 | - LastUpgradeVersion = "0720" | ||
| 3 | + LastUpgradeVersion = "0800" | ||
| 4 | 4 | version = "1.3"> | |
| 5 | 5 | <BuildAction | |
| 6 | 6 | parallelizeBuildables = "YES" | |
@@ -11,8 +11,7 @@ | |||
| 11 | 11 | buildForRunning = "YES" | |
| 12 | 12 | buildForProfiling = "YES" | |
| 13 | 13 | buildForArchiving = "YES" | |
| 14 | - buildForAnalyzing = "YES" | ||
| 15 | - hideIssues = "NO"> | ||
| 14 | + buildForAnalyzing = "YES"> | ||
| 16 | 15 | <BuildableReference | |
| 17 | 16 | BuildableIdentifier = "primary" | |
| 18 | 17 | BlueprintIdentifier = "6E7E40891C84B1A20030CEBB" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> | |
| 2 | 2 | <Scheme | |
| 3 | - LastUpgradeVersion = "0720" | ||
| 3 | + LastUpgradeVersion = "0800" | ||
| 4 | 4 | version = "1.3"> | |
| 5 | 5 | <BuildAction | |
| 6 | 6 | parallelizeBuildables = "YES" | |
@@ -11,8 +11,7 @@ | |||
| 11 | 11 | buildForRunning = "YES" | |
| 12 | 12 | buildForProfiling = "YES" | |
| 13 | 13 | buildForArchiving = "YES" | |
| 14 | - buildForAnalyzing = "YES" | ||
| 15 | - hideIssues = "NO"> | ||
| 14 | + buildForAnalyzing = "YES"> | ||
| 16 | 15 | <BuildableReference | |
| 17 | 16 | BuildableIdentifier = "primary" | |
| 18 | 17 | BlueprintIdentifier = "6E7E40991C84B3790030CEBB" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> | |
| 2 | 2 | <Scheme | |
| 3 | - LastUpgradeVersion = "0720" | ||
| 3 | + LastUpgradeVersion = "0800" | ||
| 4 | 4 | version = "1.3"> | |
| 5 | 5 | <BuildAction | |
| 6 | 6 | parallelizeBuildables = "YES" | |
@@ -11,8 +11,7 @@ | |||
| 11 | 11 | buildForRunning = "YES" | |
| 12 | 12 | buildForProfiling = "YES" | |
| 13 | 13 | buildForArchiving = "YES" | |
| 14 | - buildForAnalyzing = "YES" | ||
| 15 | - hideIssues = "NO"> | ||
| 14 | + buildForAnalyzing = "YES"> | ||
| 16 | 15 | <BuildableReference | |
| 17 | 16 | BuildableIdentifier = "primary" | |
| 18 | 17 | BlueprintIdentifier = "6E7E40A71C84B4240030CEBB" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> | |
| 2 | 2 | <Scheme | |
| 3 | - LastUpgradeVersion = "0710" | ||
| 3 | + LastUpgradeVersion = "0800" | ||
| 4 | 4 | version = "1.3"> | |
| 5 | 5 | <BuildAction | |
| 6 | 6 | parallelizeBuildables = "YES" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -90,10 +90,11 @@ | |||
| 90 | 90 | isa = PBXProject; | |
| 91 | 91 | attributes = { | |
| 92 | 92 | LastSwiftUpdateCheck = 0700; | |
| 93 | - LastUpgradeCheck = 0640; | ||
| 93 | + LastUpgradeCheck = 0800; | ||
| 94 | 94 | TargetAttributes = { | |
| 95 | 95 | 6EE9C1521B00BB5B00D6B91C = { | |
| 96 | 96 | CreatedOnToolsVersion = 6.4; | |
| 97 | + LastSwiftMigration = 0800; | ||
| 97 | 98 | }; | |
| 98 | 99 | }; | |
| 99 | 100 | }; | |
@@ -159,6 +160,7 @@ | |||
| 159 | 160 | COPY_PHASE_STRIP = NO; | |
| 160 | 161 | DEBUG_INFORMATION_FORMAT = dwarf; | |
| 161 | 162 | ENABLE_STRICT_OBJC_MSGSEND = YES; | |
| 163 | + ENABLE_TESTABILITY = YES; | ||
| 162 | 164 | GCC_C_LANGUAGE_STANDARD = gnu99; | |
| 163 | 165 | GCC_DYNAMIC_NO_PIC = NO; | |
| 164 | 166 | GCC_NO_COMMON_BLOCKS = YES; | |
@@ -225,7 +227,9 @@ | |||
| 225 | 227 | COMBINE_HIDPI_IMAGES = YES; | |
| 226 | 228 | INFOPLIST_FILE = SwiftyTimerTests/Info.plist; | |
| 227 | 229 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; | |
| 230 | + PRODUCT_BUNDLE_IDENTIFIER = "radex.$(PRODUCT_NAME:rfc1034identifier)"; | ||
| 228 | 231 | PRODUCT_NAME = "$(TARGET_NAME)"; | |
| 232 | + SWIFT_VERSION = 3.0; | ||
| 229 | 233 | }; | |
| 230 | 234 | name = Debug; | |
| 231 | 235 | }; | |
@@ -236,7 +240,10 @@ | |||
| 236 | 240 | COMBINE_HIDPI_IMAGES = YES; | |
| 237 | 241 | INFOPLIST_FILE = SwiftyTimerTests/Info.plist; | |
| 238 | 242 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; | |
| 243 | + PRODUCT_BUNDLE_IDENTIFIER = "radex.$(PRODUCT_NAME:rfc1034identifier)"; | ||
| 239 | 244 | PRODUCT_NAME = "$(TARGET_NAME)"; | |
| 245 | + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; | ||
| 246 | + SWIFT_VERSION = 3.0; | ||
| 240 | 247 | }; | |
| 241 | 248 | name = Release; | |
| 242 | 249 | }; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | <?xml version="1.0" encoding="UTF-8"?> | |
| 2 | 2 | <Scheme | |
| 3 | - LastUpgradeVersion = "0640" | ||
| 3 | + LastUpgradeVersion = "0800" | ||
| 4 | 4 | version = "1.3"> | |
| 5 | 5 | <BuildAction | |
| 6 | 6 | parallelizeBuildables = "YES" | |
@@ -11,8 +11,7 @@ | |||
| 11 | 11 | buildForRunning = "YES" | |
| 12 | 12 | buildForProfiling = "YES" | |
| 13 | 13 | buildForArchiving = "YES" | |
| 14 | - buildForAnalyzing = "YES" | ||
| 15 | - hideIssues = "NO"> | ||
| 14 | + buildForAnalyzing = "YES"> | ||
| 16 | 15 | <BuildableReference | |
| 17 | 16 | BuildableIdentifier = "primary" | |
| 18 | 17 | BlueprintIdentifier = "6EE9C1521B00BB5B00D6B91C" | |
@@ -26,8 +25,7 @@ | |||
| 26 | 25 | buildForRunning = "YES" | |
| 27 | 26 | buildForProfiling = "NO" | |
| 28 | 27 | buildForArchiving = "NO" | |
| 29 | - buildForAnalyzing = "YES" | ||
| 30 | - hideIssues = "NO"> | ||
| 28 | + buildForAnalyzing = "YES"> | ||
| 31 | 29 | <BuildableReference | |
| 32 | 30 | BuildableIdentifier = "primary" | |
| 33 | 31 | BlueprintIdentifier = "6EE9C1621B00BB5B00D6B91C" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,7 @@ | |||
| 9 | 9 | <key>CFBundleIconFile</key> | |
| 10 | 10 | <string></string> | |
| 11 | 11 | <key>CFBundleIdentifier</key> | |
| 12 | - <string>radex.$(PRODUCT_NAME:rfc1034identifier)</string> | ||
| 12 | + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
| 13 | 13 | <key>CFBundleInfoDictionaryVersion</key> | |
| 14 | 14 | <string>6.0</string> | |
| 15 | 15 | <key>CFBundleName</key> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments