Open Source Swift Library Providing A Great Syntax For Working With Dates

Earlier this year I mentioned a Swift library for working with dates inspired by Moments.js called SwiftMoment.

Here’s an open source library that provides even more help for working with dates called Timepiece by Naoto Kaneko for working with dates with an intuitive Swift syntax.

Timepiece allows easy formatting from strings, helpers for initialization, and manipulation of dates.

Here is a code snippet showing how one could manipulate and format dates:

5.minutes.later.stringFromFormat("yyyy-MM-dd HH:mm:SS")
//=> "2015-03-01 12:05:00"

"1987-06-02".dateFromFormat("yyyy-MM-dd")
//=> NSDate.date(year: 1987, month: 6, day: 2)

You can find Timepiece on Github here.

A nice library for working with dates.

Original article: Open Source Swift Library Providing A Great Syntax For Working With Dates

©2015 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 *