All Projects → eddiekaiger → SwiftyDate

eddiekaiger / SwiftyDate

Licence: MIT license
The easiest way to generate relative dates in Swift.

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language

SwiftyDate

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:

  • seconds
  • minutes
  • hours
  • days
  • weeks

Functions to generate dates:

  • fromNow()
  • ago()
  • after(date: NSDate)
  • before(date: NSDate)

Installation

CocoaPods

pod 'SwiftyDate'

Usage

import SwiftyDate


Original idea by my friend Joe.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].