What's the difference between Objective-C and Cocoa?

后端 未结 4 1705
日久生厌
日久生厌 2021-01-31 02:21

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 ea

4条回答
  •  攒了一身酷
    2021-01-31 02:57

    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.

提交回复
热议问题