Tuesday, 10 September 2013

objective-c equivalent of 'tuple unpacking'

objective-c equivalent of 'tuple unpacking'

Sometimes I get sad when I can't use Python. In Python I handle an array
of arguments, unpacking them as such:
name, handle, parent_handle, [left, top, right, bottom], showing,
scrollable = data
I must now do the same in Objective C, with NSArrays... am I doomed to 11
lines of:
NSString *name = (NSString *)[data objectAtIndex:0];
NSNumber *handle = (NSNumber *)[data objectAtIndex:1];
//....
or is there a better way?

No comments:

Post a Comment