Cocoa FAQ

From Mac Guides

Revision as of 01:06, 20 September 2009; Tylobedo (Talk | contribs)
(diff) ←Older revision | Current revision | Newer revision→ (diff)
Jump to: navigation, search

Cocoa is the official API of Mac OS X and the iPhone, supported by Apple.

Contents

General

I've never programmed before. How should I start learning Cocoa?

If you are serious about learning Cocoa and have never programmed before, it is strongly advised you learn the C language first, since Objective-C is a proper superset of C. After you are familiar with C, Objective-C will be easier. However it is not necessary to learn C immediately.

The standard reference book for C is "The C Programming Language" by Kernighan and Ritchie. There are also many online references to help you get started. In OS X you can use XCode or command-line tools such as gcc to build and run your C programs.

For Cocoa programming specifically, Apple has a guide to help you get started. There is also Cocoa Dev Central which gives an easy to follow guide to both Interface Builder and Xcode.

What should I use to write Cocoa Applications?

Whatever level you are it is recommended to use Xcode. Even if you aren't using Cocoa it is strongly recommended to install Xcode for any development work, even if you don't use it as it also installs general development resources.

What book do you recommend for learning Cocoa?

The most popular book is Cocoa Programming for Mac OS X, by Aaron Hillegass and has been updated for Leopard, Xcode3 and Objective-C 2.0.

What languages can I use to write Cocoa applications?

The official native language is Objective-C. However, Leopard includes bindings for Ruby and Python.

I have a background in Java/C++/C#/etc, how hard is it to learn Objective-C?

Objective-C is an easy language. You will be able to pick it up in about a day. Developers may feel more at home using Objective-C 2.0 (new in Leopard) which uses dot notation for properties.

Is there support for C++?

Cocoa does not support C++ directly. However, you can write applications using a mixture of C++ and Objective-C, formally called Objective-C++.

Where is the language documentation?

The language documentation is available through Help>Documentation in Xcode and Apple's Objective C documentation site. Searching for <<class name>> site:apple.com on Google will get you straight to the class you want.

iPhone

What do I need to start writing iPhone applications?

You should first have an understanding of Objective-C and Cocoa programming, as detailed above.

You should then download the Apple iPhone SDK. Apple also has a special area of their developer site for iPhone programming.

You will also need (Snow) Leopard and an Intel Mac. An iPhone or iPod touch is not required.