Get Updates By E-mail 

Article Written By:
Johann Dowa

Library With A Collection Of NSFormatter Subclasses For Formatting Common Types Of Data

  •  
  •  
  •  
  •  
  •  

Earlier this year I mentioned a handy library that allows you to quickly format NSStrings using regular expressions.

Here’s a handy library from Matt Thompson called FormatterKit that provides a number of NSFormatter subclasses for formatting various types of data.

According  to the readme FormatterKit can format the following types of data:

Addresses: Create formatted address strings from components (e.g. 221b Baker St / Paddington / Greater London / NW1 6XE / United Kingdom )
Arrays: Display NSArray elements in a comma-delimited list (e.g. “Russell, Spinoza & Rawls”)
Location, Distance & Direction: Show CLLocationDistance, CLLocationDirection, and CLLocationSpeed in metric or imperial units (eg. “240ft Northwest” / “45 km/h SE”)
Ordinal Numbers: Convert cardinal NSNumber objects to their ordinal in most major languages (eg. “1st, 2nd, 3rd” / “1ère, 2ème, 3ème”)
Time Intervals: Show relative time distance between any two NSDate objects (e.g. “3 minutes ago” / “yesterday”)
Units of Information: Humanized representations of quantities of bits and bytes (e.g. “2.7 MB”)
URL Requests: Print out cURL or Wget command equivalents for any NSURLRequest (e.g. curl -X POST “https://www.example.com/” -H “Accept: text/html”)

You can find FormatterKit on Github here.

A nice time saving library for formatting data.


  •  
  •  
  •  
  •  
  •  

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.

Comments