Remove Playground, add ScheduleDemo target
This commit is contained in:
parent
cba87f0f2b
commit
2569c9e449
|
@ -1,24 +0,0 @@
|
||||||
<?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">
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>en</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
|
||||||
<string>6.0</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>$(PRODUCT_NAME)</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>BNDL</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>1.0</string>
|
|
||||||
<key>CFBundleSignature</key>
|
|
||||||
<string>????</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>1</string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
|
@ -5,10 +5,12 @@ import PackageDescription
|
||||||
let package = Package(
|
let package = Package(
|
||||||
name: "Schedule",
|
name: "Schedule",
|
||||||
products: [
|
products: [
|
||||||
.library(name: "Schedule", targets: ["Schedule"])
|
.library(name: "Schedule", targets: ["Schedule"]),
|
||||||
|
.executable(name: "ScheduleDemo", targets: ["ScheduleDemo"])
|
||||||
],
|
],
|
||||||
targets: [
|
targets: [
|
||||||
.target(name: "Schedule"),
|
.target(name: "Schedule"),
|
||||||
.testTarget(name: "ScheduleTests", dependencies: ["Schedule"])
|
.testTarget(name: "ScheduleTests", dependencies: ["Schedule"]),
|
||||||
|
.target(name: "ScheduleDemo", dependencies: ["Schedule"])
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
//: Playground - noun: a place where people can play
|
|
||||||
|
|
||||||
import PlaygroundSupport
|
|
||||||
import Schedule
|
|
||||||
|
|
||||||
PlaygroundPage.current.needsIndefiniteExecution = true
|
|
||||||
|
|
||||||
Plan.after(1.second).do {
|
|
||||||
print("1 second passed!")
|
|
||||||
}
|
|
||||||
|
|
||||||
Plan.after(1.minute, repeating: 0.5.seconds).do {
|
|
||||||
print("Ping!")
|
|
||||||
}
|
|
||||||
|
|
||||||
Plan.every("one minute and ten seconds").do {
|
|
||||||
print("One minute and ten seconds have elapsed!")
|
|
||||||
}
|
|
||||||
|
|
||||||
Plan.every(.monday, .tuesday, .wednesday, .thursday, .friday).at(6, 30).do {
|
|
||||||
print("Get up!")
|
|
||||||
}
|
|
||||||
|
|
||||||
Plan.every(.june(14)).at("9:30").do {
|
|
||||||
print("Happy birthday!")
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
||||||
<playground version='5.0' target-platform='macos' display-mode='raw' last-migration='1000'>
|
|
||||||
<timeline fileName='timeline.xctimeline'/>
|
|
||||||
</playground>
|
|
|
@ -1,22 +1,18 @@
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = "Schedule"
|
s.name = "Schedule"
|
||||||
s.version = "1.0.0"
|
s.version = "2.0.0-beta.1"
|
||||||
s.summary = "A lightweight task scheduler for Swift."
|
s.license = { :type => "MIT" }
|
||||||
s.description = <<-DESC
|
|
||||||
Schedule is a missing lightweight task scheduler for Swift.
|
|
||||||
It allows you run timed tasks using an incredibly human-friendly syntax.
|
|
||||||
DESC
|
|
||||||
s.homepage = "https://github.com/jianstm/Schedule"
|
s.homepage = "https://github.com/jianstm/Schedule"
|
||||||
s.license = { :type => "MIT", :file => "LICENSE" }
|
|
||||||
s.author = { "Quentin Jin" => "jianstm@gmail.com" }
|
s.author = { "Quentin Jin" => "jianstm@gmail.com" }
|
||||||
s.source = { :git => "https://github.com/jianstm/Schedule.git",
|
s.summary = "Lightweight timing task scheduler"
|
||||||
:tag => "#{s.version}" }
|
|
||||||
|
s.source = { :git => "https://github.com/jianstm/Schedule.git", :tag => "#{s.version}" }
|
||||||
s.source_files = "Sources/Schedule/*.swift"
|
s.source_files = "Sources/Schedule/*.swift"
|
||||||
s.requires_arc = true
|
|
||||||
s.swift_version = "4.2"
|
s.swift_version = "4.2"
|
||||||
|
|
||||||
s.ios.deployment_target = "8.0"
|
s.ios.deployment_target = "10.0"
|
||||||
s.osx.deployment_target = "10.10"
|
s.osx.deployment_target = "10.12"
|
||||||
s.tvos.deployment_target = "9.0"
|
s.tvos.deployment_target = "10.0"
|
||||||
s.watchos.deployment_target = "2.0"
|
s.watchos.deployment_target = "3.0"
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>en</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>$(PRODUCT_NAME)</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>BNDL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string></string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
|
@ -15,13 +15,11 @@
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>FMWK</string>
|
<string>FMWK</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>2.0.0</string>
|
<string>2.0.0-beta.1</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||||
<key>NSHumanReadableCopyright</key>
|
|
||||||
<string>Copyright © 2018 Quentin Jin. All rights reserved.</string>
|
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
</dict>
|
</dict>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,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">
|
||||||
|
<dict>
|
||||||
|
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
|
||||||
|
<false/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "1000"
|
LastUpgradeVersion = "9999"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
@ -14,9 +14,23 @@
|
||||||
buildForAnalyzing = "YES">
|
buildForAnalyzing = "YES">
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "52D6D97B1BEFF229002C0205"
|
BlueprintIdentifier = "Schedule::Schedule"
|
||||||
BuildableName = "Schedule.framework"
|
BuildableName = "Schedule.framework"
|
||||||
BlueprintName = "Schedule-iOS"
|
BlueprintName = "Schedule"
|
||||||
|
ReferencedContainer = "container:Schedule.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "Schedule::ScheduleDemo"
|
||||||
|
BuildableName = "ScheduleDemo"
|
||||||
|
BlueprintName = "ScheduleDemo"
|
||||||
ReferencedContainer = "container:Schedule.xcodeproj">
|
ReferencedContainer = "container:Schedule.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</BuildActionEntry>
|
</BuildActionEntry>
|
||||||
|
@ -26,30 +40,19 @@
|
||||||
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 = "52D6D9851BEFF229002C0205"
|
BlueprintIdentifier = "Schedule::ScheduleTests"
|
||||||
BuildableName = "Schedule-iOS Tests.xctest"
|
BuildableName = "ScheduleTests.xctest"
|
||||||
BlueprintName = "Schedule-iOS Tests"
|
BlueprintName = "ScheduleTests"
|
||||||
ReferencedContainer = "container:Schedule.xcodeproj">
|
ReferencedContainer = "container:Schedule.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</TestableReference>
|
</TestableReference>
|
||||||
</Testables>
|
</Testables>
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "52D6D97B1BEFF229002C0205"
|
|
||||||
BuildableName = "Schedule.framework"
|
|
||||||
BlueprintName = "Schedule-iOS"
|
|
||||||
ReferencedContainer = "container:Schedule.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
<AdditionalOptions>
|
<AdditionalOptions>
|
||||||
</AdditionalOptions>
|
</AdditionalOptions>
|
||||||
</TestAction>
|
</TestAction>
|
||||||
|
@ -66,9 +69,9 @@
|
||||||
<MacroExpansion>
|
<MacroExpansion>
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "52D6D97B1BEFF229002C0205"
|
BlueprintIdentifier = "Schedule::Schedule"
|
||||||
BuildableName = "Schedule.framework"
|
BuildableName = "Schedule.framework"
|
||||||
BlueprintName = "Schedule-iOS"
|
BlueprintName = "Schedule"
|
||||||
ReferencedContainer = "container:Schedule.xcodeproj">
|
ReferencedContainer = "container:Schedule.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</MacroExpansion>
|
</MacroExpansion>
|
||||||
|
@ -81,15 +84,6 @@
|
||||||
savedToolIdentifier = ""
|
savedToolIdentifier = ""
|
||||||
useCustomWorkingDirectory = "NO"
|
useCustomWorkingDirectory = "NO"
|
||||||
debugDocumentVersioning = "YES">
|
debugDocumentVersioning = "YES">
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "52D6D97B1BEFF229002C0205"
|
|
||||||
BuildableName = "Schedule.framework"
|
|
||||||
BlueprintName = "Schedule-iOS"
|
|
||||||
ReferencedContainer = "container:Schedule.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
</ProfileAction>
|
</ProfileAction>
|
||||||
<AnalyzeAction
|
<AnalyzeAction
|
||||||
buildConfiguration = "Debug">
|
buildConfiguration = "Debug">
|
|
@ -1,101 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Scheme
|
|
||||||
LastUpgradeVersion = "1000"
|
|
||||||
version = "1.3">
|
|
||||||
<BuildAction
|
|
||||||
parallelizeBuildables = "YES"
|
|
||||||
buildImplicitDependencies = "YES">
|
|
||||||
<BuildActionEntries>
|
|
||||||
<BuildActionEntry
|
|
||||||
buildForTesting = "YES"
|
|
||||||
buildForRunning = "YES"
|
|
||||||
buildForProfiling = "YES"
|
|
||||||
buildForArchiving = "YES"
|
|
||||||
buildForAnalyzing = "YES">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "52D6DA0E1BF000BD002C0205"
|
|
||||||
BuildableName = "Schedule.framework"
|
|
||||||
BlueprintName = "Schedule-macOS"
|
|
||||||
ReferencedContainer = "container:Schedule.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</BuildActionEntry>
|
|
||||||
</BuildActionEntries>
|
|
||||||
</BuildAction>
|
|
||||||
<TestAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
codeCoverageEnabled = "YES"
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
|
||||||
<Testables>
|
|
||||||
<TestableReference
|
|
||||||
skipped = "NO"
|
|
||||||
parallelizable = "YES">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "DD7502791C68FCFC006590AF"
|
|
||||||
BuildableName = "Schedule-macOS Tests.xctest"
|
|
||||||
BlueprintName = "Schedule-macOS Tests"
|
|
||||||
ReferencedContainer = "container:Schedule.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</TestableReference>
|
|
||||||
</Testables>
|
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "52D6DA0E1BF000BD002C0205"
|
|
||||||
BuildableName = "Schedule.framework"
|
|
||||||
BlueprintName = "Schedule-macOS"
|
|
||||||
ReferencedContainer = "container:Schedule.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</TestAction>
|
|
||||||
<LaunchAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
launchStyle = "0"
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
|
||||||
debugDocumentVersioning = "YES"
|
|
||||||
debugServiceExtension = "internal"
|
|
||||||
allowLocationSimulation = "YES">
|
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "52D6DA0E1BF000BD002C0205"
|
|
||||||
BuildableName = "Schedule.framework"
|
|
||||||
BlueprintName = "Schedule-macOS"
|
|
||||||
ReferencedContainer = "container:Schedule.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</LaunchAction>
|
|
||||||
<ProfileAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
||||||
savedToolIdentifier = ""
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
debugDocumentVersioning = "YES">
|
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "52D6DA0E1BF000BD002C0205"
|
|
||||||
BuildableName = "Schedule.framework"
|
|
||||||
BlueprintName = "Schedule-macOS"
|
|
||||||
ReferencedContainer = "container:Schedule.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
</ProfileAction>
|
|
||||||
<AnalyzeAction
|
|
||||||
buildConfiguration = "Debug">
|
|
||||||
</AnalyzeAction>
|
|
||||||
<ArchiveAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
revealArchiveInOrganizer = "YES">
|
|
||||||
</ArchiveAction>
|
|
||||||
</Scheme>
|
|
|
@ -1,101 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Scheme
|
|
||||||
LastUpgradeVersion = "1000"
|
|
||||||
version = "1.3">
|
|
||||||
<BuildAction
|
|
||||||
parallelizeBuildables = "YES"
|
|
||||||
buildImplicitDependencies = "YES">
|
|
||||||
<BuildActionEntries>
|
|
||||||
<BuildActionEntry
|
|
||||||
buildForTesting = "YES"
|
|
||||||
buildForRunning = "YES"
|
|
||||||
buildForProfiling = "YES"
|
|
||||||
buildForArchiving = "YES"
|
|
||||||
buildForAnalyzing = "YES">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "52D6D9EF1BEFFFBE002C0205"
|
|
||||||
BuildableName = "Schedule.framework"
|
|
||||||
BlueprintName = "Schedule-tvOS"
|
|
||||||
ReferencedContainer = "container:Schedule.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</BuildActionEntry>
|
|
||||||
</BuildActionEntries>
|
|
||||||
</BuildAction>
|
|
||||||
<TestAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
codeCoverageEnabled = "YES"
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
|
||||||
<Testables>
|
|
||||||
<TestableReference
|
|
||||||
skipped = "NO"
|
|
||||||
parallelizable = "YES">
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "DD75028C1C690C7A006590AF"
|
|
||||||
BuildableName = "Schedule-tvOS Tests.xctest"
|
|
||||||
BlueprintName = "Schedule-tvOS Tests"
|
|
||||||
ReferencedContainer = "container:Schedule.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</TestableReference>
|
|
||||||
</Testables>
|
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "52D6D9EF1BEFFFBE002C0205"
|
|
||||||
BuildableName = "Schedule.framework"
|
|
||||||
BlueprintName = "Schedule-tvOS"
|
|
||||||
ReferencedContainer = "container:Schedule.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</TestAction>
|
|
||||||
<LaunchAction
|
|
||||||
buildConfiguration = "Debug"
|
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
||||||
launchStyle = "0"
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
|
||||||
debugDocumentVersioning = "YES"
|
|
||||||
debugServiceExtension = "internal"
|
|
||||||
allowLocationSimulation = "YES">
|
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "52D6D9EF1BEFFFBE002C0205"
|
|
||||||
BuildableName = "Schedule.framework"
|
|
||||||
BlueprintName = "Schedule-tvOS"
|
|
||||||
ReferencedContainer = "container:Schedule.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</LaunchAction>
|
|
||||||
<ProfileAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
||||||
savedToolIdentifier = ""
|
|
||||||
useCustomWorkingDirectory = "NO"
|
|
||||||
debugDocumentVersioning = "YES">
|
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "52D6D9EF1BEFFFBE002C0205"
|
|
||||||
BuildableName = "Schedule.framework"
|
|
||||||
BlueprintName = "Schedule-tvOS"
|
|
||||||
ReferencedContainer = "container:Schedule.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
</ProfileAction>
|
|
||||||
<AnalyzeAction
|
|
||||||
buildConfiguration = "Debug">
|
|
||||||
</AnalyzeAction>
|
|
||||||
<ArchiveAction
|
|
||||||
buildConfiguration = "Release"
|
|
||||||
revealArchiveInOrganizer = "YES">
|
|
||||||
</ArchiveAction>
|
|
||||||
</Scheme>
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "1000"
|
LastUpgradeVersion = "9999"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
@ -14,9 +14,9 @@
|
||||||
buildForAnalyzing = "YES">
|
buildForAnalyzing = "YES">
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "52D6D9E11BEFFF6E002C0205"
|
BlueprintIdentifier = "Schedule::ScheduleDemo"
|
||||||
BuildableName = "Schedule.framework"
|
BuildableName = "ScheduleDemo"
|
||||||
BlueprintName = "Schedule-watchOS"
|
BlueprintName = "ScheduleDemo"
|
||||||
ReferencedContainer = "container:Schedule.xcodeproj">
|
ReferencedContainer = "container:Schedule.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</BuildActionEntry>
|
</BuildActionEntry>
|
||||||
|
@ -26,9 +26,18 @@
|
||||||
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
|
||||||
|
skipped = "NO">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "Schedule::ScheduleTests"
|
||||||
|
BuildableName = "ScheduleTests.xctest"
|
||||||
|
BlueprintName = "ScheduleTests"
|
||||||
|
ReferencedContainer = "container:Schedule.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</TestableReference>
|
||||||
</Testables>
|
</Testables>
|
||||||
<AdditionalOptions>
|
<AdditionalOptions>
|
||||||
</AdditionalOptions>
|
</AdditionalOptions>
|
||||||
|
@ -43,15 +52,16 @@
|
||||||
debugDocumentVersioning = "YES"
|
debugDocumentVersioning = "YES"
|
||||||
debugServiceExtension = "internal"
|
debugServiceExtension = "internal"
|
||||||
allowLocationSimulation = "YES">
|
allowLocationSimulation = "YES">
|
||||||
<MacroExpansion>
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "52D6D9E11BEFFF6E002C0205"
|
BlueprintIdentifier = "Schedule::ScheduleDemo"
|
||||||
BuildableName = "Schedule.framework"
|
BuildableName = "ScheduleDemo"
|
||||||
BlueprintName = "Schedule-watchOS"
|
BlueprintName = "ScheduleDemo"
|
||||||
ReferencedContainer = "container:Schedule.xcodeproj">
|
ReferencedContainer = "container:Schedule.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</MacroExpansion>
|
</BuildableProductRunnable>
|
||||||
<AdditionalOptions>
|
<AdditionalOptions>
|
||||||
</AdditionalOptions>
|
</AdditionalOptions>
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
|
@ -61,15 +71,6 @@
|
||||||
savedToolIdentifier = ""
|
savedToolIdentifier = ""
|
||||||
useCustomWorkingDirectory = "NO"
|
useCustomWorkingDirectory = "NO"
|
||||||
debugDocumentVersioning = "YES">
|
debugDocumentVersioning = "YES">
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "52D6D9E11BEFFF6E002C0205"
|
|
||||||
BuildableName = "Schedule.framework"
|
|
||||||
BlueprintName = "Schedule-watchOS"
|
|
||||||
ReferencedContainer = "container:Schedule.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
</ProfileAction>
|
</ProfileAction>
|
||||||
<AnalyzeAction
|
<AnalyzeAction
|
||||||
buildConfiguration = "Debug">
|
buildConfiguration = "Debug">
|
|
@ -42,6 +42,13 @@ extension Time {
|
||||||
|
|
||||||
extension Plan {
|
extension Plan {
|
||||||
|
|
||||||
|
/// Creates a plan from an interval sequence.
|
||||||
|
/// The task will be executed after each interval in the sequence.
|
||||||
|
@available(*, deprecated, message: "Use Plan.of")
|
||||||
|
public static func from<S>(_ sequence: S) -> Plan where S: Sequence, S.Element == Interval {
|
||||||
|
return Plan.of(sequence)
|
||||||
|
}
|
||||||
|
|
||||||
/// Creates a plan from a date sequence.
|
/// Creates a plan from a date sequence.
|
||||||
/// The task will be executed at each date in the sequence.
|
/// The task will be executed at each date in the sequence.
|
||||||
/// - Note: Returns `Plan.never` if given no parameters.
|
/// - Note: Returns `Plan.never` if given no parameters.
|
||||||
|
|
|
@ -6,13 +6,14 @@ import Foundation
|
||||||
/// `Plan` is `Interval` based.
|
/// `Plan` is `Interval` based.
|
||||||
public struct Plan {
|
public struct Plan {
|
||||||
|
|
||||||
private var sequence: AnySequence<Interval>
|
private var iSeq: AnySequence<Interval>
|
||||||
|
|
||||||
private init<S>(_ sequence: S) where S: Sequence, S.Element == Interval {
|
private init<S>(_ sequence: S) where S: Sequence, S.Element == Interval {
|
||||||
self.sequence = AnySequence(sequence)
|
iSeq = AnySequence(sequence)
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeIterator() -> AnyIterator<Interval> {
|
func makeIterator() -> AnyIterator<Interval> {
|
||||||
return sequence.makeIterator()
|
return iSeq.makeIterator()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Schedules a task with this plan.
|
/// Schedules a task with this plan.
|
||||||
|
@ -67,12 +68,6 @@ extension Plan {
|
||||||
return Plan(AnySequence(makeUnderlyingIterator))
|
return Plan(AnySequence(makeUnderlyingIterator))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a plan from an interval sequence.
|
|
||||||
/// The task will be executed after each interval in the sequence.
|
|
||||||
public static func from<S>(_ sequence: S) -> Plan where S: Sequence, S.Element == Interval {
|
|
||||||
return Plan(sequence)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Creates a plan from a list of intervals.
|
/// Creates a plan from a list of intervals.
|
||||||
/// The task will be executed after each interval in the array.
|
/// The task will be executed after each interval in the array.
|
||||||
/// - Note: Returns `Plan.never` if given no parameters.
|
/// - Note: Returns `Plan.never` if given no parameters.
|
||||||
|
@ -83,8 +78,7 @@ extension Plan {
|
||||||
/// Creates a plan from a list of intervals.
|
/// Creates a plan from a list of intervals.
|
||||||
/// The task will be executed after each interval in the array.
|
/// The task will be executed after each interval in the array.
|
||||||
/// - Note: Returns `Plan.never` if given an empty array.
|
/// - Note: Returns `Plan.never` if given an empty array.
|
||||||
public static func of(_ intervals: [Interval]) -> Plan {
|
public static func of<S>(_ intervals: S) -> Plan where S: Sequence, S.Element == Interval {
|
||||||
guard !intervals.isEmpty else { return .never }
|
|
||||||
return Plan(intervals)
|
return Plan(intervals)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -405,15 +399,15 @@ extension Plan {
|
||||||
public static func every(_ weekday: Weekday) -> DateMiddleware {
|
public static func every(_ weekday: Weekday) -> DateMiddleware {
|
||||||
let plan = Plan.make { () -> AnyIterator<Date> in
|
let plan = Plan.make { () -> AnyIterator<Date> in
|
||||||
let calendar = Calendar.gregorian
|
let calendar = Calendar.gregorian
|
||||||
var date: Date!
|
var date: Date?
|
||||||
return AnyIterator<Date> {
|
return AnyIterator<Date> {
|
||||||
if Date().is(weekday) {
|
if let d = date {
|
||||||
|
date = calendar.date(byAdding: .day, value: 7, to: d)
|
||||||
|
} else if Date().is(weekday) {
|
||||||
date = Date().startOfToday
|
date = Date().startOfToday
|
||||||
} else if date == nil {
|
} else {
|
||||||
let components = weekday.toDateComponents()
|
let components = weekday.toDateComponents()
|
||||||
date = calendar.nextDate(after: Date(), matching: components, matchingPolicy: .strict)
|
date = calendar.nextDate(after: Date(), matching: components, matchingPolicy: .strict)
|
||||||
} else {
|
|
||||||
date = calendar.date(byAdding: .day, value: 7, to: date)
|
|
||||||
}
|
}
|
||||||
return date
|
return date
|
||||||
}
|
}
|
||||||
|
@ -445,15 +439,15 @@ extension Plan {
|
||||||
public static func every(_ monthday: Monthday) -> DateMiddleware {
|
public static func every(_ monthday: Monthday) -> DateMiddleware {
|
||||||
let plan = Plan.make { () -> AnyIterator<Date> in
|
let plan = Plan.make { () -> AnyIterator<Date> in
|
||||||
let calendar = Calendar.gregorian
|
let calendar = Calendar.gregorian
|
||||||
var date: Date!
|
var date: Date?
|
||||||
return AnyIterator<Date> {
|
return AnyIterator<Date> {
|
||||||
if Date().is(monthday) {
|
if let d = date {
|
||||||
|
date = calendar.date(byAdding: .year, value: 1, to: d)
|
||||||
|
} else if Date().is(monthday) {
|
||||||
date = Date().startOfToday
|
date = Date().startOfToday
|
||||||
} else if date == nil {
|
} else {
|
||||||
let components = monthday.toDateComponents()
|
let components = monthday.toDateComponents()
|
||||||
date = calendar.nextDate(after: Date(), matching: components, matchingPolicy: .strict)
|
date = calendar.nextDate(after: Date(), matching: components, matchingPolicy: .strict)
|
||||||
} else {
|
|
||||||
date = calendar.date(byAdding: .year, value: 1, to: date)
|
|
||||||
}
|
}
|
||||||
return date
|
return date
|
||||||
}
|
}
|
||||||
|
@ -484,7 +478,7 @@ extension Plan {
|
||||||
|
|
||||||
extension Plan {
|
extension Plan {
|
||||||
public func isNever() -> Bool {
|
public func isNever() -> Bool {
|
||||||
return self.sequence.makeIterator().next() == nil
|
return self.iSeq.makeIterator().next() == nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ open class Task {
|
||||||
private var _timer: DispatchSourceTimer
|
private var _timer: DispatchSourceTimer
|
||||||
|
|
||||||
private lazy var _onElapseActions = Cabinet<Action>()
|
private lazy var _onElapseActions = Cabinet<Action>()
|
||||||
private var _onDeinitActions = Cabinet<Action>()
|
private lazy var _onDeinitActions = Cabinet<Action>()
|
||||||
|
|
||||||
private lazy var _suspensions: UInt64 = 0
|
private lazy var _suspensions: UInt64 = 0
|
||||||
private lazy var _timeline = Timeline()
|
private lazy var _timeline = Timeline()
|
||||||
|
@ -64,8 +64,8 @@ open class Task {
|
||||||
_timeline.estimatedNextExecution = Date().adding(interval)
|
_timeline.estimatedNextExecution = Date().adding(interval)
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskCenter.default.add(self)
|
|
||||||
_timer.resume()
|
_timer.resume()
|
||||||
|
TaskCenter.default.add(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
//
|
||||||
|
// Log.swift
|
||||||
|
// Schedule
|
||||||
|
//
|
||||||
|
// Created by Quentin Jin on 2019/3/12.
|
||||||
|
// Copyright © 2019 Schedule. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
let fmt = ISO8601DateFormatter()
|
||||||
|
|
||||||
|
func Log(_ t: Any) {
|
||||||
|
let now = fmt.string(from: Date())
|
||||||
|
print("[\(now)]: \(t)")
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
//
|
||||||
|
// main.swift
|
||||||
|
// Schedule
|
||||||
|
//
|
||||||
|
// Created by Quentin Jin on 2019/3/12.
|
||||||
|
// Copyright © 2019 Schedule. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import Schedule
|
||||||
|
|
||||||
|
Log("Wake up")
|
||||||
|
|
||||||
|
let t1 = Plan.after(1.second).do {
|
||||||
|
Log("1 second passed!")
|
||||||
|
}
|
||||||
|
|
||||||
|
let t2 = Plan.after(1.minute, repeating: 0.5.seconds).do {
|
||||||
|
Log("Ping!")
|
||||||
|
}
|
||||||
|
|
||||||
|
let t3 = Plan.every("one minute and ten seconds").do {
|
||||||
|
Log("One minute and ten seconds have elapsed!")
|
||||||
|
}
|
||||||
|
|
||||||
|
let t4 = Plan.every(.monday, .tuesday, .wednesday, .thursday, .friday).at(6, 50).do {
|
||||||
|
Log("Get up!")
|
||||||
|
}
|
||||||
|
|
||||||
|
let t5 = Plan.every(.march(14)).at("08:59:59 am").do {
|
||||||
|
Log("Happy birthday!")
|
||||||
|
}
|
||||||
|
|
||||||
|
RunLoop.current.run()
|
Loading…
Reference in New Issue