iPhone Code-Snippets

by Enno Welbers, written on 02.04.2010 Permalink

During development of iPhone Applications, you collect a bunch of helpful code fragments. Thanks to Objective C's nature it is possible to keep those fragments structured. My own collection is available here. Additionally, i keep them in a github repository:

List of Snippets

  • NSArray (SortArray)
    This addition adds an initializer to NSArray which generates an array containing a single NSSortDescriptor object. Very useful when it comes to core data.
  • NSSortDescriptor (Initializer)
    This adds a static initializer to reduce the alloc/init/autorelease lines.
  • NSString (ApplicationDirectory)
    Adds an initializer which returns a String containing the Documents Directory for the current application.
  • NSString (KeychainAdditions)
    Adds a few functions to interface the Keychain using NSString. Supports Keychain's internet account data type and allows to query, add and delete those accounts.
  • NSData (Base64Conversion)
    Adds functions to convert a binary stream to it's Base64 Counterpart and vice versa.

This package is from April 1st, 2010: snippets.zip