Latest 0.1.1
License Apache
Platforms ios 4.0

Set of extensions to Objective-C, which should make your coding easier.


  • ex_as:(Class)cls
  • ex_as:(Class)cls strict:(BOOL)strict

Allows to safely "cast" objects to expected class. Great when you get id as a result but have to make sure it’s a selected class (ex. when getting JSON).

Convenience methods

  • ex_asString
  • ex_asNumber
  • ex_asArray
  • ex_asDictionary
  • ex_asSet


- (void)fetchPost
    [self.backendManager fetchJSONFromURL:[NSURL URLWithString:@"http://someurl"] 
                           withCompletion:^(id responeObject) {
        NSDictionary *jsonDict = [responseObject ex_as:[NSDictionary class]];
        // or [responeObject ex_asDictionary] for short
        if (jsonDict) { // <- this will be nil if responseObject wasn't NSDictionary
                        // in most cases it would be safe to skip the if and just get nils
            NSString *title = jsonDict[@"title"];
            NSString *username = jsonDict[@"username"];
            // ...


If you don’t want to use ex_ prefix for all those methods, define OBJEX_AS_SHORTHAND in your project.

Latest podspec

    "name": "ObjExC",
    "version": "0.1.1",
    "summary": "Useful categories of Foundation/Cocoa classes.",
    "homepage": "",
    "license": "Apache",
    "authors": {
        "Jarek Pendowski": "[email protected]"
    "social_media_url": "",
    "source": {
        "git": "",
        "tag": "v0.1.1"
    "source_files": "Categories/NSObject+ObjExC.{h,m}",
    "platforms": {
        "ios": "4.0"
    "requires_arc": false

Pin It on Pinterest

Share This