Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of the CoreFoundation framework? [closed]

Tags:

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.

  1. What is the purpose of CoreFoundation framework?
  2. Doesn't the Cocoa Framework provide every thing that's needed already?
  3. 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.

like image 454
Just a coder Avatar asked Jul 11 '12 15:07

Just a coder


People also ask

What is foundation framework in IOS?

The Foundation framework provides a base layer of functionality for apps and frameworks, including data storage and persistence, text processing, date and time calculations, sorting and filtering, and networking.

What is the difference between core and foundation?

Core Foundation is a general-purpose C framework whereas Foundation is a general-purpose Objective-C framework. Both provide collection classes, run loops, etc, and many of the Foundation classes are wrappers around the CF equivalents.


1 Answers

History: The Foundation dates to ~1993/1994 and the APIs therein were a part of the OpenStep APIs published by NeXT.

What is the purpose of CoreFoundation framework?

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.

Doesn't the Cocoa Framework provide every thing that's needed already?

More or less. And, certainly moreso for building GUI applications on either iOS or OS X.

Does the CoreFoundation Framework provide any advantages that the CocoaFramework does not provide?

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.

like image 151
bbum Avatar answered Sep 19 '22 16:09

bbum