TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Sep 2016 |
SPMSupports SPM | ✗ |
Maintained by Eddie Kaiger.
SwiftyDate allows you to easily create relative NSDates in Swift.
It extends the Swift number types to allow you to create expressions like this:
let pastDate = 12.days.ago()
let futureDate = 7.weeks.fromNow()
let beforeDate = 5.minutes.before(anotherDate)
let afterDate = 15.hours.after(anotherDate)
Includes extensions for NSTimeInterval
, Double
, Int
, Float
, CGFloat
, and NSNumber
.
Time interval types:
Functions to generate dates:
fromNow()
ago()
after(date: NSDate)
before(date: NSDate)
CocoaPods
pod 'SwiftyDate'
import SwiftyDate
Original idea by my friend Joe.