⭐️
不要忘记通过给出一个如何安装
CocoaPods
SwifCron 通过 CocoaPods 提供。
要安装它,只需在您的 Podfile 中添加以下行
pod 'SwifCron', '~> 1.3.0'
Swift 包管理器
.package(url: "https://github.com/MihaelIsaev/SwifCron.git", from:"1.3.0")
在您的目标依赖中添加 "SwifCron"
,例如这样
.target(name: "App", dependencies: ["SwifCron"]),
用法
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)
}
限制
我以 CrontabGuru 为参考
所以你可以解析由数字、*
、,
、/
和 -
符号组成的任何表达式
贡献
请随时贡献!
待办事项
- 编写更多测试
- 支持表达式中的月份和星期几的文本名称
- 支持非标准数字,例如表达式中的星期几部分使用
7
作为星期日