I have been programming in Objective-C Cocoa for a little while using NSObjects etc. I see that there is another framework: CoreFoundation.As i look it over, it seems to be a C-Style framework.
So I have some curiosities i’d like clarified. I’ve googled but found no direct answer.
- What is the purpose of CoreFoundation framework?
- Doesn’t the Cocoa Framework provide every thing that’s needed already?
- Does the CoreFoundation Framework provide any advantages that the CocoaFramework does not provide?
These are some of the questions i have. If anyone can provide an answer, or provide me with resources to read about it, that would be great. I am wondering if its worth learning more about the framework.
History: The Foundation dates to ~1993/1994 and the APIs therein were a part of the OpenStep APIs published by NeXT.
CF was created during the transition of Mac OS to Mac OS X to help support that transition. Initially, it was done both for speed and to allow purely non-Objective-C programs to be written. Over time, that has proven to be a non-issue and CF has more and more bits that are implemented in Objective-C (have a look at the CoreFoundation binary using something like otool).
CFLite is a light-weight, portable, pure-C (IIRC) variant.
More or less. And, certainly moreso for building GUI applications on either iOS or OS X.
Several, but generally at a cost of decreased simplicity and increased fragility.
For example, the CF collections allow you to completely customize how memory is managed and objects are identified; you can provide custom allocation/free/hashing/comparison hooks. Through this, you can “easily” encapsulate non-Objective-C types in CF collections.