I'm just learning Objective-C/Cocoa programming for the Mac. All of the tutorials, books, blogs, podcasts, etc. I've been using really cover the two together. Is there an easy way to tell which pieces are vanilla Objective-C and which come from Cocoa?
In OS X, Cocoa has two core Objective-C frameworks that are essential to application development for OS X: AppKit. AppKit, one of the application frameworks, provides the objects an application displays in its user interface and defines the structure for application behavior, including event handling and drawing.
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.
In 1996 Apple overtook NeXT, which developer tools would use Objective-C. These tools were later included in Xcode. That's how Apple began using Objective-C for Mac OS X development. As a result, Objective-C became the first choice language for everybody who wanted to create an application for OS X and iOS.
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.
Objective-C is the language... it defines all the things like the keywords for defining objects, the syntax for messaging object, things like that.
Cocoa is a development framework (it's actually an umbrella framework which combines three other frameworks, Foundation, AppKit and CoreData).
These frameworks (Cocoa) define all the objects that are nice to use and interact with the operating system, as well as a number of functions. For example, Cocoa defines things like NSString
and NSObject
. Cocoa can currently be used with other language bindings, such as python or ruby, and used to be used with Java as well. So, if you were using Cocoa with Java, you would still get an NSString
object, but you would call and use it from within a Java application.
Without linking to one of the Cocoa frameworks, Objective-C comes with only a very basic Object class as a pre-defined root class.
Objective-C is the language itself.
Cocoa, formerly NextStep, is the API and runtime that sits on top of Obj-C. Anything starting with NS (for NextStep) is part of Cocoa, not part of the language.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With