I am currently learning Objective-C and Cocoa. Next, I want to stick up to iPhone programming. I'll get a book for that, of course. But I would like to know now already, what the main differences are between Cocoa and Cocoa Touch.
The core concepts of Cocoa and Cocoa touch are similar, in that there is a view hierarchy and responder chain. However, the UIView architecture is much more closely tied to the more recent technologies such as CoreAnimation.
The types of controls that are available also change.
Additionally, Cocoa touch introduces the concept of UIViewControllers, which create a nice abstraction for putting code that interacts with your main program and the specific view it owns. As Chuck pointed out in the comments, this was added in Cocoa in Mac OS X 10.5, so depending on how you learned Cocoa you may or may not be aware of them.
Finally, as others have mentioned, Garbage Collection does not exist on the iPhone currently.
To add to what others have said, much of the foundation is shared between Cocoa Touch and Cocoa. For example, data type classes like NSString
and collection classes like NSArray
are identical in both frameworks. Other classes like NSURLConnection
are substantially the same. Other high-level frameworks, like Core Data for example, are absent from Cocoa Touch.
Also, Cocoa Touch was developed with Objective-C 2.0. So UIKit, the Cocoa Touch framework counterpart to AppKit in Cocoa, makes extensive use of properties. In many ways, Cocoa Touch is more modern than Cocoa. Cocoa Touch also tends to use the Objective-C @protocol
syntax instead of the older category syntax for implementing what Apple calls "informal protocols" (i.e. protocols where some methods are optional)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With