views:

86

answers:

2

I'm currently reading Aaron Hillegass' book "Cocoa Programming for Mac OS X" as it is highly recommended throughout the community. I'm wondering if there's an extreme difference between "Cocoa Programming" and iPhone development. I'm more interested in iPhone development, but I figured iPhone development would be easier to pick up if I was comfortable with Cocoa before moving on.

+6  A: 

iPhone programming is a form of Cocoa (technically "Cocoa Touch"). It shares almost all the same programming idioms, and there's a huge overlap in the frameworks.

Hillegass' book is a great starting point for either. After about chapter 7 in Hillegass, you'll start getting into more "Mac" topics like document window management etc. None of this is bad to understand, but that's where it begins to differ in the details, and you'll find that it won't translate quite so directly.

The patterns he teaches you to think in will be useful in all cases. But the actual classes and objects you use for the Mac stuff don't all have equivalences in the iPhone world. On iOS, the view management (UIView) is quite different from Mac's NSView stuff. It's actually simpler and easier to understand on the iPhone, I found.

Hillegass has a new iPhone-specific book out. I haven't browsed through it yet.

quixoto
I just wanted to say the same. The Hilegass book is great but after a short while, it becomes pretty Mac-specific.
Phlibbo
Thanks. I'm on chapter 21 o.O... I think there's only around 34 chapters, so I guess I might as well finish then. I just didn't want to waste my time if they were two different worlds.
Stanley
+2  A: 

The biggest difference is that there is no garbage collection in iPhone programming. You will be making a lot of retain and release calls that are not needed in MacOS Cocoa.

A second difference is that some of Apple's classes are different. In general, some of the less-frequently-used methods are gone from the iPhone versions of classes.

Lastly, you have all the UIKit classes such as UITableView, UITouch, and so on, which do not have counterparts in MacOS.

William Jockusch
IIRC, you have to explicitly enable garbage collection on OS X, and it's only been available since 10.5 anyway.
tc.