DateSequence
示例
要运行示例测试,克隆仓库,然后首先从 Example 目录运行 pod install
。接着打开 DateSequence.xcworkspace
并在 DateSequence/Test/Tests.swift
中运行测试。
// Bounded sequences
let dates = try! DateSequence(from: "2018-01-01", through: "2018-06-04", every: (7, .day))
// See also `DateSequence(from: to: every:)`
try! dates.contains("2018-03-05") // true
for d in dates {
print(DashedISO8601DateFormatter.shared.string(from: d))
// "2018-01-01", "2018-01-08", ... "2018-06-04"
}
依赖要求
DateSequence 需要 iOS 10.0+,因为该版本添加了一些巧妙的日期计算 API。
安装
DateSequence 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod 'DateSequence'
许可证
DateSequence 在 MIT 许可证下提供。查看 LICENSE 文件获取更多信息。