Tuesday December 11, 2012

`instancetype`, or How to Sneak Type Inference Into The Room

Thanks to NSHipster’s review of instancetype, I now know that I can define class methods like this:

+ (instancetype)awesomeObjectWithName:(NSString *)name
{
    // ...
}

Instead of this:

+ (NSAwesomeObject *)awesomeObjectWithName:(NSString *)name
{
    // ...
}

I sure hope this means we’re going to get more and more type inference in Objective-C.