Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MorphingDragon

macrumors 603
Original poster
Mar 27, 2009
5,159
6
The World Inbetween
This is just a bit of forethought

I've just about gone through the Obj-C part of SK twice now (Didn't completely understand some of the material) book but I also have Aaron Hillegass' book. My ultimate goal is to do GUI based work which is why I bought Aaron's book (I can see myself doing some CLI programs) but read SK's Obj-C book on recommendation because I didn't know C.

Should I do the Foundation Framework part of the book anyway? Could I use the Foundation Framework and Cocoa together for any arbitrary reason and it wouldn't cause problems?

---

In chapter 13 it has information on the underlying features of C, if I do this chapter would I essentially "know" C? As I'm very interested in Operating System Development. :)
 
The Foundation framework is the basis of everything in Cocoa. There is no Cocoa without Foundation.
 
And if you create a Cocoa project, you will notice that both frameworks are already included to be linked against your code. :)
 
Foundation is the framework that provides all the non-GUI classes; data structures (NSArray, NSDictionary, etc.), networking stuff (NSURL, NSConnection, etc.), files (NSFileManager, etc.), threads, run loops, timers, etc. It's on the Mac and the iPhone.

Cocoa is the framework that provides all the GUI widgets. It's Mac only. The iPhone version is called Cocoa Touch. Cocoa and Cocoa Touch are built upon the Foundation framework. As gnasher729 says, there is no Cocoa without Foundation.

I believe it's possible to write a command-line Objective-C app that uses only Foundation and not Cocoa, but I've never tried it.

And what's the difference between "Foundation" and "Core Foundation"? Core Foundation is the plain C API that provides most of the same functionality as the (Objective-C) Foundation framework. Most Foundation and Core Foundation data structures (ex. CFArray and NSArray) are interchangeable due to "toll-free bridging."
 
I thought Cocoa encapsulated both Foundation and AppKit (the desktop UI APIs), and Cocoa Touch encapsulated Foundation and UIKit. In other words, that Cocoa is not just the UI stuff, but the whole thing.
 
HiRez is correct. There are also a few classes that are implemented in Foundation but have categories extending them in AppKit (NSAttributedString for example).
 
It's definitely possible, I've done it many times :)

Actually, most of my projects start out as Foundation. The M part of MVC usually won't have any Cocoa stuff in it. Only after the model is working fine do I start adding the second layer of complexity that is the GUI.

Ashley
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.