Remove Playground, add ScheduleDemo target

This commit is contained in:
Quentin Jin 2019-03-14 21:24:14 +08:00
parent cba87f0f2b
commit 2569c9e449
19 changed files with 615 additions and 1408 deletions

View File

@ -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>

View File

@ -5,10 +5,12 @@ import PackageDescription
let package = Package(
name: "Schedule",
products: [
.library(name: "Schedule", targets: ["Schedule"])
.library(name: "Schedule", targets: ["Schedule"]),
.executable(name: "ScheduleDemo", targets: ["ScheduleDemo"])
],
targets: [
.target(name: "Schedule"),
.testTarget(name: "ScheduleTests", dependencies: ["Schedule"])
.testTarget(name: "ScheduleTests", dependencies: ["Schedule"]),
.target(name: "ScheduleDemo", dependencies: ["Schedule"])
]
)

View File

@ -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!")
}

View File

@ -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>

View File

@ -1,22 +1,18 @@
Pod::Spec.new do |s|
s.name = "Schedule"
s.version = "1.0.0"
s.summary = "A lightweight task scheduler for Swift."
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.version = "2.0.0-beta.1"
s.license = { :type => "MIT" }
s.homepage = "https://github.com/jianstm/Schedule"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Quentin Jin" => "jianstm@gmail.com" }
s.source = { :git => "https://github.com/jianstm/Schedule.git",
:tag => "#{s.version}" }
s.summary = "Lightweight timing task scheduler"
s.source = { :git => "https://github.com/jianstm/Schedule.git", :tag => "#{s.version}" }
s.source_files = "Sources/Schedule/*.swift"
s.requires_arc = true
s.swift_version = "4.2"
s.ios.deployment_target = "8.0"
s.osx.deployment_target = "10.10"
s.tvos.deployment_target = "9.0"
s.watchos.deployment_target = "2.0"
s.ios.deployment_target = "10.0"
s.osx.deployment_target = "10.12"
s.tvos.deployment_target = "10.0"
s.watchos.deployment_target = "3.0"
end

View File

@ -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>

View File

@ -15,13 +15,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.0.0</string>
<string>2.0.0-beta.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2018 Quentin Jin. All rights reserved.</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>

File diff suppressed because it is too large Load Diff

View File

@ -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>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
LastUpgradeVersion = "9999"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -14,9 +14,23 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "52D6D97B1BEFF229002C0205"
BlueprintIdentifier = "Schedule::Schedule"
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">
</BuildableReference>
</BuildActionEntry>
@ -26,30 +40,19 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "52D6D9851BEFF229002C0205"
BuildableName = "Schedule-iOS Tests.xctest"
BlueprintName = "Schedule-iOS Tests"
BlueprintIdentifier = "Schedule::ScheduleTests"
BuildableName = "ScheduleTests.xctest"
BlueprintName = "ScheduleTests"
ReferencedContainer = "container:Schedule.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "52D6D97B1BEFF229002C0205"
BuildableName = "Schedule.framework"
BlueprintName = "Schedule-iOS"
ReferencedContainer = "container:Schedule.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
@ -66,9 +69,9 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "52D6D97B1BEFF229002C0205"
BlueprintIdentifier = "Schedule::Schedule"
BuildableName = "Schedule.framework"
BlueprintName = "Schedule-iOS"
BlueprintName = "Schedule"
ReferencedContainer = "container:Schedule.xcodeproj">
</BuildableReference>
</MacroExpansion>
@ -81,15 +84,6 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "52D6D97B1BEFF229002C0205"
BuildableName = "Schedule.framework"
BlueprintName = "Schedule-iOS"
ReferencedContainer = "container:Schedule.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">

View File

@ -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>

View File

@ -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>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
LastUpgradeVersion = "9999"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -14,9 +14,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "52D6D9E11BEFFF6E002C0205"
BuildableName = "Schedule.framework"
BlueprintName = "Schedule-watchOS"
BlueprintIdentifier = "Schedule::ScheduleDemo"
BuildableName = "ScheduleDemo"
BlueprintName = "ScheduleDemo"
ReferencedContainer = "container:Schedule.xcodeproj">
</BuildableReference>
</BuildActionEntry>
@ -26,9 +26,18 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Schedule::ScheduleTests"
BuildableName = "ScheduleTests.xctest"
BlueprintName = "ScheduleTests"
ReferencedContainer = "container:Schedule.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
@ -43,15 +52,16 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "52D6D9E11BEFFF6E002C0205"
BuildableName = "Schedule.framework"
BlueprintName = "Schedule-watchOS"
BlueprintIdentifier = "Schedule::ScheduleDemo"
BuildableName = "ScheduleDemo"
BlueprintName = "ScheduleDemo"
ReferencedContainer = "container:Schedule.xcodeproj">
</BuildableReference>
</MacroExpansion>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
@ -61,15 +71,6 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "52D6D9E11BEFFF6E002C0205"
BuildableName = "Schedule.framework"
BlueprintName = "Schedule-watchOS"
ReferencedContainer = "container:Schedule.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">

View File

@ -42,6 +42,13 @@ extension Time {
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.
/// The task will be executed at each date in the sequence.
/// - Note: Returns `Plan.never` if given no parameters.

View File

@ -6,13 +6,14 @@ import Foundation
/// `Plan` is `Interval` based.
public struct Plan {
private var sequence: AnySequence<Interval>
private var iSeq: AnySequence<Interval>
private init<S>(_ sequence: S) where S: Sequence, S.Element == Interval {
self.sequence = AnySequence(sequence)
iSeq = AnySequence(sequence)
}
func makeIterator() -> AnyIterator<Interval> {
return sequence.makeIterator()
return iSeq.makeIterator()
}
/// Schedules a task with this plan.
@ -67,12 +68,6 @@ extension Plan {
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.
/// The task will be executed after each interval in the array.
/// - Note: Returns `Plan.never` if given no parameters.
@ -83,8 +78,7 @@ extension Plan {
/// Creates a plan from a list of intervals.
/// The task will be executed after each interval in the array.
/// - Note: Returns `Plan.never` if given an empty array.
public static func of(_ intervals: [Interval]) -> Plan {
guard !intervals.isEmpty else { return .never }
public static func of<S>(_ intervals: S) -> Plan where S: Sequence, S.Element == Interval {
return Plan(intervals)
}
}
@ -405,15 +399,15 @@ extension Plan {
public static func every(_ weekday: Weekday) -> DateMiddleware {
let plan = Plan.make { () -> AnyIterator<Date> in
let calendar = Calendar.gregorian
var date: Date!
var date: 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
} else if date == nil {
} else {
let components = weekday.toDateComponents()
date = calendar.nextDate(after: Date(), matching: components, matchingPolicy: .strict)
} else {
date = calendar.date(byAdding: .day, value: 7, to: date)
}
return date
}
@ -445,15 +439,15 @@ extension Plan {
public static func every(_ monthday: Monthday) -> DateMiddleware {
let plan = Plan.make { () -> AnyIterator<Date> in
let calendar = Calendar.gregorian
var date: Date!
var date: 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
} else if date == nil {
} else {
let components = monthday.toDateComponents()
date = calendar.nextDate(after: Date(), matching: components, matchingPolicy: .strict)
} else {
date = calendar.date(byAdding: .year, value: 1, to: date)
}
return date
}
@ -484,7 +478,7 @@ extension Plan {
extension Plan {
public func isNever() -> Bool {
return self.sequence.makeIterator().next() == nil
return self.iSeq.makeIterator().next() == nil
}
}

View File

@ -24,7 +24,7 @@ open class Task {
private var _timer: DispatchSourceTimer
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 _timeline = Timeline()
@ -64,8 +64,8 @@ open class Task {
_timeline.estimatedNextExecution = Date().adding(interval)
}
TaskCenter.default.add(self)
_timer.resume()
TaskCenter.default.add(self)
}
deinit {

View File

@ -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)")
}

View File

@ -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()