Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences Between Cocoa and iPhone development

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.

like image 653
A Wizard Did It Avatar asked Oct 01 '10 20:10

A Wizard Did It


People also ask

What is the difference between Cocoa and Cocoa Touch in Swift?

Both Cocoa and Cocoa Touch include the Objective-C runtime and two core frameworks: Cocoa, which includes the Foundation and AppKit frameworks, is used for developing applications that run on OS X. Cocoa Touch, which includes Foundation and UIKit frameworks, is used for developing applications that run on iOS.

What is Cocoa in iPhone?

Cocoa is an application environment for both the OS X operating system and iOS, the operating system used on Multi-Touch devices such as iPhone, iPad, and iPod touch. It consists of a suite of object-oriented software libraries, a runtime system, and an integrated development environment.

What is Cocoa framework?

The Cocoa frameworks. The classes in Foundation provide objects and functionality that are the basis, or “foundation,” of Cocoa. The classes in Application Kit furnish the objects and behavior that your users see in the user interface, such as windows and buttons, and handle their mouse clicks and key presses.

What is Cocoa coding?

Unlike development frameworks that give lip service to object-oriented programming but make it difficult to reuse code modules, Cocoa aims to wring the most output for a programmer's input possible. Following the Objective-C method, Cocoa makes it simple to reuse code.


2 Answers

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.

like image 56
Ben Zotto Avatar answered Oct 20 '22 00:10

Ben Zotto


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.

like image 35
William Jockusch Avatar answered Oct 20 '22 02:10

William Jockusch