Convert to Modern Objective-C Syntax

I thought I’d give this a roll. So, in Xcode I ran it from Edit > Refactor.

Pleasantly surprised at how straightforwards it was.

Quick reminder:


@[@"a String"] == [NSArray arrayWithObject:@"a String"]

arrayOfObjects[i] ==  [arrayOfObjects objectAtIndex:i]


key: dictionary[@"SearchResponse"] == [dictionary objectForKey:@"SearchResponse"]

declare: @{@"key": @"object"} == [NSDictionary dictionaryWithObject:@"value" forKey:@"key"]


@1000 == [NSNumber numberWithInt:1000]

The only problems that seem to need looking out for are:

1. relying on early nil termination of arguments when creating an array

2. the need to box BOOL values

Leave a Reply

Your email address will not be published. Required fields are marked *