Core Foundation (also called CF) is a
C application programming interface
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standard that des ...
(API) written by
Apple Inc. for its
operating system
An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ...
s, and is a mix of low-level routines and
wrapper functions. Most Core Foundation routines follow a certain naming convention that deal with opaque objects, for example CFDictionaryRef for functions whose names begin with CFDictionary, and these objects are often
reference
A reference is a relationship between objects in which one object designates, or acts as a means by which to connect to or link to, another object. The first object in this relation is said to ''refer to'' the second object. It is called a ''nam ...
counted (manually) through
CFRetain
and
CFRelease
. Internally, Core Foundation forms the base of the types in the
Objective-C
Objective-C is a high-level general-purpose, object-oriented programming language that adds Smalltalk-style message passing (messaging) to the C programming language. Originally developed by Brad Cox and Tom Love in the early 1980s, it was ...
standard library and the
Carbon API.
The most prevalent use of Core Foundation is for passing its own primitive types for data, including raw
byte
The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable un ...
s,
Unicode
Unicode or ''The Unicode Standard'' or TUS is a character encoding standard maintained by the Unicode Consortium designed to support the use of text in all of the world's writing systems that can be digitized. Version 16.0 defines 154,998 Char ...
strings,
number
A number is a mathematical object used to count, measure, and label. The most basic examples are the natural numbers 1, 2, 3, 4, and so forth. Numbers can be represented in language with number words. More universally, individual numbers can ...
s,
calendar date
A calendar date is a reference to a particular day, represented within a calendar system, enabling a specific day to be unambiguously identified. Simple math can be performed between dates; commonly, the number of days between two dates may be ca ...
s, and
UUIDs, as well as collections such as
arrays
An array is a systematic arrangement of similar objects, usually in rows and columns.
Things called an array include:
{{TOC right
Music
* In twelve-tone and serial composition, the presentation of simultaneous twelve-tone sets such that the ...
,
set
Set, The Set, SET or SETS may refer to:
Science, technology, and mathematics Mathematics
*Set (mathematics), a collection of elements
*Category of sets, the category whose objects and morphisms are sets and total functions, respectively
Electro ...
s, and
dictionaries
A dictionary is a listing of lexemes from the lexicon of one or more specific languages, often arranged Alphabetical order, alphabetically (or by Semitic root, consonantal root for Semitic languages or radical-and-stroke sorting, radical an ...
, to numerous macOS
C routines, primarily those that are
GUI-related. At the operating system level Core Foundation also provides standardized application preferences management through
CFPropertyList
,
bundle handling,
run loops,
interprocess communication through
CFMachPort
and
CFNotificationCenter
, and a basic
graphical user interface
A graphical user interface, or GUI, is a form of user interface that allows user (computing), users to human–computer interaction, interact with electronic devices through Graphics, graphical icon (computing), icons and visual indicators such ...
message dialog through
CFUserNotification
.
Other parts of the API include utility routines and wrappers around existing APIs for ease of use. Utility routines perform such actions as
file system and
network I/O through
CFReadStream
,
CFWriteStream
, and
CFURL
and
endianness
file:Gullivers_travels.jpg, ''Gulliver's Travels'' by Jonathan Swift, the novel from which the term was coined
In computing, endianness is the order in which bytes within a word (data type), word of digital data are transmitted over a data comm ...
translation (Byte Order Utilities). Some examples of wrapper routines include those for Core Foundation's wrapper routines for Unix sockets, the CFSocket API.
Some types in Core Foundation are "toll-free bridged", or interchangeable with a simple cast, with those of their
Foundation Kit counterparts. For example, one could create a
CFDictionaryRef
Core Foundation type, and then later simply use a standard C cast to convert it to its Objective-C counterpart,
NSDictionary *
, and then use the desired Objective-C methods on that object as one normally would.
Core Foundation has a plug-in model () that is based on the
Microsoft
Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
Component Object Model
Component Object Model (COM) is a binary-interface technology for software components from Microsoft that enables using objects in a language-neutral way between different programming languages, programming contexts, processes and machines ...
.
Open source availability
Apple
An apple is a round, edible fruit produced by an apple tree (''Malus'' spp.). Fruit trees of the orchard or domestic apple (''Malus domestica''), the most widely grown in the genus, are agriculture, cultivated worldwide. The tree originated ...
used to release most of CF as an
open-source project called CFLite that can be used to write cross-platform applications for macOS,
Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
, and
Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
.
A third-party open-source implementation called OpenCFLite extends the Apple CFLite for building on 32-bit
Windows
Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
and
Linux
Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
environments. It is maintained by one of the
WebKit
WebKit is a browser engine primarily used in Apple's Safari web browser, as well as all web browsers on iOS and iPadOS. WebKit is also used by the PlayStation consoles starting with the PS3, the Tizen mobile operating systems, the Amazon K ...
developers, but was stalled by 2015. The karaoke platform KJams maintains a fork since 2017. This version, by its programmer David M. Cotter, supports 64-bit systems and has a CFNetwork implementation with
LibreSSL-based TLS. A fork of OpenCFLite was created by Grant Erickson (an original collaborator with Brent Fulgham on the SourceForge version) in 2021 with a companion port of the
CFHost
portion of CFNetwork, as OpenCFNetwork.
The Swift Corelib Foundation, a fallback version of the
Foundation Kit for the Swift programming language for non-Apple platforms, contains a near-full version of the Core Foundation released under
Apache License 2.0.
GNUstep
GNUstep is a free software implementation of the Cocoa (formerly OpenStep) Objective-C frameworks, widget toolkit, and application development tools for Unix-like operating systems and Microsoft Windows. It is part of the GNU Project.
GNUst ...
includes a version of the Core Foundation called "libs-corebase".
See also
*
GLib – the
GNOME Project equivalent
References
External links
Core Foundation referenceat
Apple Developer
OpenCFLiteat SourceForge
CFLite including CFNetworkworks in 64bit, uses LibreSSL (TLS 1.1, 1.2)
{{macOS
MacOS APIs