Core Foundation

Core Foundation (also called CF) is a C application programming interface (API) in macOS and iOS, 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 counted (manually) through CFRetain and CFRelease. Internally, Core Foundation forms the base of the types in the Objective-C standard library and the Carbon API.[1]

Core Foundation
Developer(s)Apple Inc.
TypeSystem library
LicenseAPSL 2.0
Websitedeveloper.apple.com

The most prevalent use of Core Foundation is for passing its own primitive types for data, including raw bytes, Unicode strings, numbers, calendar dates, and UUIDs, as well as collections such as arrays, sets, and dictionaries, 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 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 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 (CFPlugin) that is based on the Microsoft Component Object Model.[2]

Open source availability

Apple 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, and Windows.[3]

A third-party open-source implementation called OpenCFLite extends the Apple CFLite for building on 32-bit Windows and Linux environments. It is maintained by one of the WebKit developers, but was stalled by 2015.[4] 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.[5]

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.[6]

GNUstep includes a version of the Core Foundation called "libs-corebase". It is not as complete enough for the project to use it as the basis of their Foundation Kit implementation like Apple does for its implementations. (The only CF-based Foundation API in GNUstep is CFURL, as of February 2020.)[7]

gollark: Oh no, how DARE they talk about a bug shown by a public published binary.
gollark: I didn't make any analogies like that, and this doesn't seem to have been a security issue. Additionally, based on your displayed attitudes I doubt there would have been a bug report without them forcing it.
gollark: Basically all of them encourage different ones.
gollark: Assembly language compiling to websocket frames.
gollark: Hmm...

See also

  • GLib – the GNOME equivalent

References

  1. ridiculous_fish (2006). "Bridge".
  2. "Plug-ins and Microsoft's COM". Mac Developer Library. Apple Inc. Archived from the original on September 1, 2014. Retrieved March 25, 2015.
  3. http://opensource.apple.com/source/CF/
  4. OpenCFLite project on SourceForge.
  5. "CFLite". KJams. Retrieved February 19, 2020.
  6. "swift-corelibs-foundation". GitHub.
  7. "gnustep/libs-corebase: The GNUstep CoreBase Library is a library of general-purpose, non-graphical C objects". GitHub. GNUstep. November 19, 2019.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.