Computer Programming/MacOS Programming
From Wikibooks, the open-content textbooks collection
[edit] About the platform
MacOS is the primary operating system for the Macintosh computer. It was originally a system designed privately by Apple Inc, however after MacOS X, it has been based on a modified FreeBSD operating system, Darwin.
The most popular languages for use on the MacOS platform include C, Objective-C, and C++.
[edit] Design thoughts
See Programming:Objective-C for a lesson on the basics of Objective-C [1] may also be of assistance.
Some preliminary thoughts:
- C, Objective-C, and C++ are the three languages most commonly used in Mac OS Programming. Objective-C entered Mac OS X and has ancestry in NeXT. C++ works because it is an extension to C and can call C functions, though Objective-C is more common when programming Cocoa. Before you learn Mac programming you must know the basics of C syntax, since either language is based on C.
- There are three ways to write a Mac GUI program: Classic (Mac OS 9 and lower), Carbon (Mac OS 8.5? and up) and Cocoa (Mac OS X and up). Cocoa is the most powerful, from its ancestry in the OPENSTEP libraries. Carbon is powerful and works on older versions. Classic is a bit simpler, but does not work in Mac OS X (unless with Classic emulation). Also, you can write command-line UNIX programs and compile them with GCC (cc or c++) and Terminal.
- Mac resources are sometimes stored in the same file as the executable, with a resource fork. A program like ResEdit (free from apple.com somewhere) or Resorcerer (more powerful, commercial product) can manage resources. Resources include icons, custom mouse cursors, string tables, dialogs, sound effects, etc. In fact, it is possible to modify the resources of an executable, without the source code and without recompiling, and have the new resources read in.