Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Convenience Cocoa classes, extending default functionality for a bunch of Cocoa objects.

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 CoreData
Octocat-spinner-32 Foundation
Octocat-spinner-32 UIKit
Octocat-spinner-32 Convenience.h
Octocat-spinner-32 README.mdown

Using the classes

  1. Include all of the classes into your Xcode project.
  2. Ideally, in your Project_Prefix.pch pre-compiled header file, include the following line:
    #import "Convenience.h"
  3. All of the convenience classes, #define's, and category extensions are now available to you.

Foundation extensions

  • General

    • UKLog():
      NSLog logging only when DEBUG compiler directive is defined, and with nice method names.
  • NSObject class extensions:

    • -className
      Returns the class name of the current object as an NSString.
  • NSArray class extensions:

    • -firstObject
      Returns the first object in the array, to complement the already existing -lastObject
  • NSDictionary class extensions:

    • -initWithData: and +dictionaryWithData: initializers
      Initialize an NSDictionary with a given NSData object, but without the need for reading the data from a file or URL.
  • NSData class extensions:

    • +dataFromBase64String:
      Create a new autoreleased NSData object from a Base64 encoded NSString.
    • -base64EncodedString
      Get a new autoreleased NSString instance containing the Base64 string representing the data.

Core Data extensions

  • NSManagedObjectContext class extensions:
    • -fetchObjectsForEntityName:withPredicate:
      Single method implementation for performing simple fetches of Core Data entities using a simple query.
    • -objectWithURI: Safely fetch an object from a managed object context by its URI.


  • General

    • UIKit+Dimensions.h provides several static definitions on default heights and sizes of iPhone screens and/or controls.
  • UIView class extensions:

    • -allDescendingSubviews
      Returns an NSArray containing all subviews (recursively) of the current view.
  • UIAlertView class extensions:

    • +alertWithTitle:message:
      Simply show a simple alert view with a title, a message and an OK button.
  • UIBarButtonItem class extensions:

    • +spacerBarButtonItem
      Creates a new autoreleased UIBarButtonItem that is a flexible spacer item.
  • UIImage class extensions:

    • -scaleImageToSize: and +imageWithImage:scaledToSize:
      Scaling images down to a given size. Allows for non-proportional scaling.
    • -aspectFillImageToSize: and +imageWithImage:aspectFillToSize:
      Scaling images down by aspect-filling to a given size.


Credits remain where credits belong:

  • Uli Kusterer for UKLog (source)
  • Matt Gallagher for NSData+Base64 (source)
  • Matt Gallagher for NSManagedObjectContext+MGOneLineFetch (source)
  • Matt Gallagher for NSManagedObjectContext+MGSafeFetchedObjectFromURI (source)
Something went wrong with that request. Please try again.