Cocoa

Article:
Cocoa Tutorials

Updated: June 14, 2012

What's this about?

Cocoa is a software framework in MacOSX for programming applications and system code. It's not easy to sum up exactly what Cocoa is. I think the best way to explain it to say it's the gateway to Apple's technology. The iPhone SDK is provided in Cocoa.

These tutorials are about Cocoa and Obj/C which is the most common way to use Cocoa. I have never used the language bindings provided for Python and Ruby.

I've been quite active recently on a web forum http://cocoaforum.com. Almost all the visitors are new to Cocoa and I like writing little example programs to help explain the system. The tutorials here are based on conversations I've enjoyed with folks on this subject. I hope you find them useful.

Article
TutorialDescriptionTutorialCode

BYOB4 Build your own web browser with WebKit - for Xcode 4.1 BYOB4.pdf BYOB4.zip
BYOB Build your own web browser with WebKit - for Xcode 3.2.1 BYOB.pdf BYOB.zip
Clock4 Very simple Cocoa/UI Application for Xcode 4.3
This is the "hello world" of Cocoa and Obj/C
An application for total beginners
Clock4.pdf Clock4.zip
Clock Very simple Cocoa/UI Application
This is the "hello world" of Cocoa and Obj/C
An application for total beginners
Clock.pdf Clock.zip
console This is a very simple command-line application.   
The purpose of this article is to demonstrate (and explain) different strategies in MacOS-X for linking code:
  Direct    static libraries     dynamic libraries     Frameworks  
console.pdf console.zip
Dialogs Working with Dialog Boxes
Using Modal Dialogs, Modeless Dialogs and Sheets
Use of NSOpenPanel and NSAlertPanel
Communicating between dialogs using:
      direct calls
      delegation
      notification
      bindings
Dialogs.pdf Dialogs.zip
Diary Document with Strings and Dates
"Classic" NSDocument and NSArrayController application
Explains Binding in Interface Builder
Custom Printing
Use of @property and @synthesize keywords
Diary.pdf Diary.zip
Favorites How to manage user preferences
The code also deals with the NSAlert Panel.
Favorites.pdf Favorites.zip
Favorite
Document
This tutorial saves and reads Favorites as Documents
The tutorial also deals with menus
The tutorial also deals with refactoring projects and code.
The tutorial also deals with the NSFileOpen Panel
Favorite
Document.pdf
Favorite
Document.zip
ix Icon eXtractor.
Converts graphical files (including icons) into PDF files.   
ix.pdf ix.zip
Listen Application which uses the Speech Recognizer and Speech Synthesizer.
Discussion about learning Cocoa and Obj/C.
The relationship between Interface Builder, Xcode and Nib Files.
Adding a custom build step to put the build time into the About Box.
Listen.pdf Listen.zip
MenuBar Working with the System Menu Bar
Running UNIX commands from Cocoa
Working with Info.plist
MenuBar.pdf MenuBar.zip
Obj/C and
C and C++
Mixing Obj/C and C and C++ in a single project    
Calling C++ objects from Obj/C (trivial)
Calling Obj/C object from C++ (not difficult)
ObjCandCandC++.pdf ObjCandCandC++.zip
Regular Expressions Adding a category for regular expressions    
Calling UNIX library functions from Objective/C

Regular
Expressions.pdf
Regular
Expressions.zip
Quartz
Clock
A CustomView that uses Quartz to draw a clock.
We also draw a custom icon in the dock.
Obj/C category feature.
Discussion of the Quartz Imaging Model.
Quartz
Clock.pdf
Quartz
Clock.zip

Let me know if you'd like a tutorial on a subject. Even better, send me your code and I'll document and publish your work.

I have code written for more tutorials. Subjects "in the works" include: CoreData (SQLite), Internet Protocols, Sockets, Client-Server applications, Rendering web sites as images and PDFs. Other ideas include: building your own framework, using the document scanner and using the NSOutline class. I hope to publish all of them by the end of July 2010.


Comments?

I'm very happy to accept comments, feedback and suggestions for any of my articles. I'm always happy to hear you - especially if you have constructive suggestions. And I'm particularily pleased if you can let me know about corrections.


Home ......... About

Page design © 1996-2012 Robin Mills / webmaster@clanmills.com

Updated Thursday June 14, 2012