This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed. Find sources: "Foundation Kit" – news ·newspapers ·books ·scholar ·JSTOR(December 2009) (Learn how and when to remove this message) |
TheFoundation Kit, or justFoundation for short, is anObjective-Cframework in theOpenStep specification described byNeXT Computer, Inc. It provides basic classes such as wrapper classes and data structure classes. This framework uses the prefix NS (forNeXTSTEP[1]). It is also part ofCocoa and of theSwift standard library.
This class is the most common base class forObjective-C hierarchies and provides standard methods for working with objects bymanaging the memory associated with them and querying them.
A class used forstring manipulation, representing aUnicode string (most typically using UTF-16 as its internal format). NSString is immutable, and thus can only be initialized but not modified. NSMutableString is a modifiable version.
NSValue is a wrapper class forC data types, and NSNumber is a wrapper class forC number data types such asint,double, andfloat. Thedata structures in Foundation Kit can only hold objects, not primitive types, so wrappers such as NSValue and NSNumber are used in those data structures.
A dynamic array of objects, supporting constant-time indexing. NSArray is an immutable version that can only be initialized with objects but not modified. NSMutableArray may be modified by adding and removing objects.
An associative data container of key-value pairs with unique keys. Searching and element addition and removal (in the case of NSMutableDictionary) is faster-than-linear. However, the order of the elements within the container is not guaranteed.
An associative container of unique keys, similar to NSDictionary, with the difference that members do not contain a data object.
A wrapper for raw byte data. An object of this type can dynamically allocate and manage its data, or it can refer to data owned by and managed by something else (such as a static numeric array).
Classes that store times and dates and represent calendrical information. They offer methods for calculating date and time differences. Together with NSLocale, they provide methods for displaying dates and times in many formats, and for adjusting times and dates based on location in the world.
The Foundation Kit is part of the macOSCocoa API. Beginning as the successor toOPENSTEP/Mach, this framework has deviated fromOpenStep compliance, and is in some places incompatible. The Foundation Kit is in the iOSCocoa Touch API. This framework is based on the macOS Cocoa.
The Foundation Kit is implemented inGNUstep's Base Package (libs-base). This implementation is mostly comparable (4 classes are missing) and aims to be comparable with both theOpenStep API and latermacOS additions. The missing classes have been dropped by Apple as well.[2]
The Foundation Kit is implemented inCocotron, an open-source implementation of Cocoa. It is also a part ofDarling.
PureFoundation is an open-source implementation of Foundation that implements Foundation by wrappingCore Foundation, just like in Cocoa, rather than create a separate Foundation from scratch like GNUstep and Cocotron.
SwiftFoundation (swift-corelibs-foundation) is Apple's open-sourceSwift implementation of the Foundation API for platforms where there is no Objective-C runtime. It also includes an implementation ofCore Foundation.[3]
ApportableFoundation is an implementation of Foundation Kit (Foundation, CoreFoundation, and CFNetwork) based on Apple's CFLite release. It works onAndroid and otherLinux systems, and makes up part of the Darling macOS translation layer for Linux.