Foundation Kit
| Company type | Software framework |
|---|---|
| Industry | Software development |
| Founder | NeXT Computer, Inc. |
| Products | Objective-C framework for macOS and iOS |
| Parent | NeXT Computer, Inc. |
The Foundation Kit, commonly referred to as Foundation, is an Objective-C framework defined within the OpenStep standard created by NeXT Computer, Inc.. It offers fundamental classes such as wrappers and data structure classes, all prefixed with NS (originating from NeXTSTEP). Foundation serves as a core component of both the Cocoa environment and the Swift standard library.
NSObject
Serving as the fundamental base class in Objective-C class hierarchies, NSObject delivers essential functionality for memory management and object inspection.
NSString and NSMutableString
These classes manage string operations with support for Unicode encoding (commonly UTF-16). NSString instances are immutable, whereas NSMutableString permits string content modifications.
NSValue and NSNumber
These wrapper classes encapsulate C data types; NSValue is designed for general C types, while NSNumber specifically wraps numeric primitives such as int, double, and float. This design allows primitive data types to be stored within Foundation’s object-only collections.
NSArray and NSMutableArray
Dynamic array classes that provide constant-time access by index. NSArray represents an immutable array, while NSMutableArray enables addition and removal of elements.
NSDictionary and NSMutableDictionary
These are associative containers storing unique key-value pairs. NSMutableDictionary supports modification with efficient lookup capabilities, although it does not maintain a guaranteed order of elements.
NSSet and NSMutableSet
Collections containing unique keys without associated values, functioning similarly to NSDictionary but storing only keys.
NSData and NSMutableData
Wrapper classes for raw byte buffers that can either manage their own memory or reference externally managed data sources.
NSDate, NSTimeZone and NSCalendar
Classes designed to represent dates, time zones, and calendar information, providing methods for date calculations and localized formatting based on time zone settings.
macOS and iOS
The Foundation Kit forms a vital part of the macOS Cocoa framework, evolving from the earlier OPENSTEP/Mach framework. Although it has deviated from strict adherence to the original OpenStep specification, it remains foundational within both macOS and iOS Cocoa Touch APIs.
GNUstep
GNUstep’s Base Package (libs-base) delivers a Foundation Kit implementation that largely aligns with both the original OpenStep API and subsequent versions used in macOS, lacking only four classes that Apple has also deprecated.
Cocotron
Cocotron offers an open-source Foundation Kit implementation and is integrated into the Darling project, which acts as a macOS compatibility layer on Linux systems.
PureFoundation
PureFoundation is an open-source implementation of Foundation that acts as a wrapper over Core Foundation, emulating Cocoa’s approach rather than reconstructing Foundation from the ground up as GNUstep and Cocotron do.
SwiftFoundation
SwiftFoundation (also known as swift-corelibs-foundation) represents Apple’s open-source Swift-based Foundation API designed for environments without an Objective-C runtime, including a Core Foundation implementation.
ApportableFoundation
ApportableFoundation delivers implementations of Foundation Kit elements (including Foundation, CoreFoundation, and CFNetwork) derived from Apple's CFLite version. It is compatible with Android as well as various Linux platforms and plays a role in the development of the Darling macOS compatibility framework.