Get Updates By E-mail 

Article Written By:
Johann Dowa

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.


Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.