Skip to content

⏱Simple pure swift cron expression parser

License

Notifications You must be signed in to change notification settings

swiftbar/SwifCron

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mihael Isaev

MIT License Swift 4.2 Cocoapod Github Actions Swift.Stream


Don't forget to support the lib by giving a ⭐️

How to install

CocoaPods

SwifCron is available through CocoaPods

To install it, simply add the following line in your Podfile:

pod 'SwifCron', '~> 1.3.0'

Swift Package Manager

.package(url: "https://github.com/MihaelIsaev/SwifCron.git", from:"1.3.0")

In your target's dependencies add "SwifCron" e.g. like this:

.target(name: "App", dependencies: ["SwifCron"]),

Usage

import SwifCron

do {
    let cron = try SwifCron("* * * * *")

    //for getting next date related to current date
    let nextDate = try cron.next()

    //for getting next date related to custom date
    let nextDate = try cron.next(from: Date())
} catch {
    print(error)
}

Limitations

I use CrontabGuru as a reference

So you could parse any expression which consists of digits with * , / and - symbols

Contributing

Please feel free to contribute!

ToDo

  • write more tests
  • support literal names of months and days of week in expression
  • support non-standard digits like 7 for Sunday in day of week part of expression

About

⏱Simple pure swift cron expression parser

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 94.3%
  • Ruby 5.7%