Extensive Swift Based Helper Library For Working With Dates

I’ve mentioned a number of Swift helper libraries such as Dollar.$wift which provides a functional programming toolbelt inspired by Underscore.js and Asterism.

Here’s a library providing an extensive date helper that extends NSDate providing dozens of new functions for setting, comparing, adjusting, printing, calculating intervals, and decomposing dates into their components.

This example from the readme shows off the date from string functionality of the library:

// Date from String with custom format
NSDate(fromString: "16 July 1972 6:12:00 ", format: .Custom("dd MMM yyyy HH:mm:ss")) -> NSDate
// Date from ISO8601 String
NSDate(fromString: "1972-07-16T08:15:30-05:00", format: .ISO8601) -> NSDate
// Date from DotNetJSON String
NSDate(fromString: "/Date(1260123281843)/", format: .DotNet) -> NSDate
// Date from RSS String
NSDate(fromString: "Fri, 09 Sep 2011 15:26:08 +0200", format: .RSS) -> NSDate
// Date from AltRSS String
NSDate(fromString: "09 Sep 2011 15:26:08 +0200", format: .AltRSS) -> NSDate -> NSDate

You can find AFDateHelper on Github here.

A great library for working with dates.

FacebookTwitterDiggStumbleUponGoogle Plus

Original article: Extensive Swift Based Helper Library For Working With Dates

©2014 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *