0% found this document useful (0 votes)
308 views14 pages

Objective-C and Cocoa: Warner Onstine President, Sandcast Software

The document discusses Objective-C and Cocoa. It defines Objective-C as an extension of C that provides object-oriented capabilities. It also defines Cocoa as a set of libraries for interacting with macOS, including Foundation Kit, AppKit, and others. The document then covers various aspects of Objective-C like protocols, categories, delegates, selectors, and UI building. It also discusses unit testing and new Cocoa features like Core Data and bindings.

Uploaded by

Nikhil Garg
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
308 views14 pages

Objective-C and Cocoa: Warner Onstine President, Sandcast Software

The document discusses Objective-C and Cocoa. It defines Objective-C as an extension of C that provides object-oriented capabilities. It also defines Cocoa as a set of libraries for interacting with macOS, including Foundation Kit, AppKit, and others. The document then covers various aspects of Objective-C like protocols, categories, delegates, selectors, and UI building. It also discusses unit testing and new Cocoa features like Core Data and bindings.

Uploaded by

Nikhil Garg
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Objective-C and Cocoa

Warner Onstine
President, Sandcast Software

sandcastsoftware.com June 13, 2006


What is Objective-C?
• Extension of C to provide an object-oriented
interface
• Developed as a reaction to the up and
coming C++ development
• Closely related to Smalltalk in ideas and
some syntax
• Originally developed by Stepstone software
• Adopted by NeXT Computer for developing
applications on NeXTStep

sandcastsoftware.com June 13, 2006


What is Cocoa?

• A set of libraries for interacting with OS X


• Foundation Kit
• AppKit
• Core Audio
• Core Image
• Web Kit (open source now)
• …plus many more

sandcastsoftware.com June 13, 2006


Comparing Obj-C with Java

• Java Interfaces and Objective-C Protocols


• Types of Protocols
– Formal and informal
• No there is no garbage collection
– Init and alloc

sandcastsoftware.com June 13, 2006


Protocols

• Informal - NSTableDataSource
• Formal - NSCoding

sandcastsoftware.com June 13, 2006


Categories

• Allows classes to override previously defined


classes essentially replacing their
implementation with a custom one

sandcastsoftware.com June 13, 2006


Objective-C Class definitions

• Header files
• Implementation files

sandcastsoftware.com June 13, 2006


Delegates

• Similar to event listeners in Java land


• Delegates can handle events and hand them
off to other classes for handling

sandcastsoftware.com June 13, 2006


Selectors

• Selectors give the developer the ability to


pass in a specific method to another class
• Chapter 8 pg. 186

sandcastsoftware.com June 13, 2006


UI Building

• Introduction to Interface Builder

sandcastsoftware.com June 13, 2006


Unit testing

• OCUnit - was external, now bundled with


Xcode
– http://www.sente.ch/software/ocunit/
• UnitKit - created by James Duncan Davidson
– http://unitkit.org/

sandcastsoftware.com June 13, 2006


New features

• Core Data
• Cocoa bindings
• Core Image

sandcastsoftware.com June 13, 2006


Sample Application -iWorkout

sandcastsoftware.com June 13, 2006


Resources

• Learning Cocoa with Objective-C by James


Duncan Davidson
• Cocoa Programming for Mac OS X by Aaron
Hillegass

• Both excellent books for starting to learn


programming on OS X

sandcastsoftware.com June 13, 2006

You might also like