Starting down the path of objectifying C
OK, so I’ve had my head in and out of books lately trying to learn obj-C and Cocoa. So far it’s not too bad. Kinda fun to be back into a little more strict C-style world, while still maintaining some cool OO features.
My biggest gotchas/gripes I’ve found so far?
1) Having to add a nil to the end of a declared NSArray or NSDictionary (or their mutable variants).
[NSArray arrayWithObjects:@"1", @"2", @"3", nil];
That just seems like something that could be abstracted away for you…
2) Declaring a NSDictionary with keys and values is backward from what I would expect from Ruby land.
// what I expect
[NSDictionary dictionaryWithObjectsAndKeys:
@"key1", @"value1", @"key2", @"value2",nil];
// what reality is
[NSDictionary dictionaryWithObjectsAndKeys:
@"value1", @"key1", @"value2", @"key2",nil];
3) And as you can see from the examples above… the biggest gotcha of all is that to declare a string you have to prefix it with @.
(Hopefully I’ll start actually putting up stuff on this tumblelog again now…)