Use `CFRunLoopTimerCreateWithHandler` to create timer
This commit is contained in:
parent
5eff428099
commit
c3ee993fa9
|
@ -5,10 +5,10 @@ import PackageDescription
|
||||||
let package = Package(
|
let package = Package(
|
||||||
name: "Schedule",
|
name: "Schedule",
|
||||||
platforms: [
|
platforms: [
|
||||||
.macOS(.v10_12),
|
.macOS(.v10_11),
|
||||||
.iOS(.v10),
|
.iOS(.v9),
|
||||||
.tvOS(.v10),
|
.tvOS(.v9),
|
||||||
.watchOS(.v3)
|
.watchOS(.v2)
|
||||||
],
|
],
|
||||||
products: [
|
products: [
|
||||||
.library(name: "Schedule", targets: ["Schedule"])
|
.library(name: "Schedule", targets: ["Schedule"])
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
@ -15,7 +14,7 @@
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>FMWK</string>
|
<string>FMWK</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>2.0.2</string>
|
<string>1.0</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -26,12 +26,10 @@
|
||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
codeCoverageEnabled = "YES"
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||||
<Testables>
|
<Testables>
|
||||||
<TestableReference
|
<TestableReference
|
||||||
skipped = "NO"
|
skipped = "NO">
|
||||||
parallelizable = "YES">
|
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "Schedule::ScheduleTests"
|
BlueprintIdentifier = "Schedule::ScheduleTests"
|
||||||
|
@ -41,8 +39,6 @@
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</TestableReference>
|
</TestableReference>
|
||||||
</Testables>
|
</Testables>
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction
|
<LaunchAction
|
||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
|
@ -54,17 +50,6 @@
|
||||||
debugDocumentVersioning = "YES"
|
debugDocumentVersioning = "YES"
|
||||||
debugServiceExtension = "internal"
|
debugServiceExtension = "internal"
|
||||||
allowLocationSimulation = "YES">
|
allowLocationSimulation = "YES">
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "Schedule::Schedule"
|
|
||||||
BuildableName = "Schedule.framework"
|
|
||||||
BlueprintName = "Schedule"
|
|
||||||
ReferencedContainer = "container:Schedule.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
<ProfileAction
|
<ProfileAction
|
||||||
buildConfiguration = "Release"
|
buildConfiguration = "Release"
|
||||||
|
|
|
@ -59,14 +59,10 @@ private final class RunLoopTask: Task {
|
||||||
timer.fireDate = Date()
|
timer.fireDate = Date()
|
||||||
}
|
}
|
||||||
|
|
||||||
timer = Timer(
|
timer = CFRunLoopTimerCreateWithHandler(kCFAllocatorDefault, Date.distantFuture.timeIntervalSinceReferenceDate, .greatestFiniteMagnitude, 0, 0, { [weak self] _ in
|
||||||
fire: Date.distantFuture,
|
|
||||||
interval: .greatestFiniteMagnitude,
|
|
||||||
repeats: true
|
|
||||||
) { [weak self] _ in
|
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
action(self)
|
action(self)
|
||||||
}
|
})
|
||||||
|
|
||||||
RunLoop.current.add(timer, forMode: mode)
|
RunLoop.current.add(timer, forMode: mode)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue