Schedule
hourglass_flowing_sand Schedule is a light-weight task scheduler for Swift. It allows you run timed tasks using an incredibly human-friendly syntax.
Features
- [x] ? Variety of Rules Schedule
- [x] ? Human Readable Period Parse
- [x] ? Suspend, Resume, Cancel
- [x] ? Reschedule
- [x] ? Tag-based Management
- [x] ? Child-action Add/Remove
- [x] ? Thread safe
- [x] ? Full Control Over the Lift Time
- [x] ? No Need to Worry About Runloop
- [x] ? No Need to Worry About Circular Reference
- [x] ? Incredibly Human Friendly API
Why should you Use Schedule Instead of Timer?
A chart is worth a thousand words:
Features | Timer | DispatchSourceTimer | Schedule |
---|---|---|---|
⏰ Interval-based Schedule | ✓ | ✓ | ✓ |
? Date-based Schedule | ✓ | ✓ | |
? Mixing Rules Schedule | ✓ | ||
? Human Readable Period Parse | ✓ | ||
? Suspende/Resume, Cancel | ✓ | ✓ | |
? ReSchedule | ✓ | ✓ | |
? Tag-based management | ✓ | ||
? Child-action Add/Remove | ✓ | ||
? Atomic Operations | ✓ | ||
? Realtime Timeline Inspect | ✓ | ||
? Life Time Control | ✓ | ||
? Incredibly Human Friendly API | ✓ |
Usage
Scheduling a task can't be simplier:
Interval-based Schedule
Date-based Schedule
Mixing Rules Schedule
Human Readable Period Parse
Task Management
In general, you don't need to worry about reference management of the task any more. All tasks will be retained internally, so they won't be released, unless you do it yourself.
Schedule lets you handle a task's lifecycle with a more elegant way:
Handle
Tag
You can organize tasks with tag
, and use queue
to define where the task should be dispatched:
Action
Aciton
is smaller unit of Task
, A task is composed of a series of actions.
Lifecycle
You can get the current timeline of the task:
You also can specify task's lifetime:
Requirements
- Swift 4.x
- All Apple platforms are supported!
- And since there is no use of
NS
class, it should supports linux, too!
Installation
Cocoapods
Replace YOUR_TARGET_NAME and then run:
Carthage
Add this to Cartfile
github "jianstm/Schedule"
Then run:
Swift Package Manager
Then run: