I am pleased to say that I just sent my first iPhone app out to some friends to beta test. I expect to forward it along to Apple for inclusion in the App Store some time in the next week or two.
At this point, I am far more comfortable with Objective-C and the Cocoa class hierarchy than I was even a month ago. I still think Objective-C is awful. You take a nice functional Smalltalk-ish language, you throw away most of the functional
, you pretend like you have garbage collection when you don’t, you strip out any form of execution control, you add some funky compiler pragma-looking things (including one called synthesize
that only fabricates about half of what you’d want it to build), you change the semantics of ->
, and then you interleave it with C! Wahoo! Instant headache!
But, after I found the for-each sort of construction, my code got quite a bit simpler. A whole bunch of loops like this:
NSEnumerator* ee = [myArray enumerator];
MyItem* item;
while ( ( item = (MyItem*)[ee nextObject] ) != nil ) {
...
}
went to this:
for ( MyItem* item in myArrayOrEnumerator ) {
...
}