The Foundation Framework

Framework
/System/Library/Frameworks/Foundation.framework
Header file directories
/System/Library/Frameworks/Foundation.framework/Headers
Declared in
FoundationErrors.h
IKPictureTaker.h
NSAffineTransform.h
NSAppleEventDescriptor.h
NSAppleEventManager.h
NSAppleScript.h
NSArchiver.h
NSArray.h
NSAttributedString.h
NSAutoreleasePool.h
NSBundle.h
NSByteOrder.h
NSCalendar.h
NSCalendarDate.h
NSCharacterSet.h
NSClassDescription.h
NSCoder.h
NSComparisonPredicate.h
NSCompoundPredicate.h
NSConnection.h
NSData.h
NSDate.h
NSDateFormatter.h
NSDecimal.h
NSDecimalNumber.h
NSDictionary.h
NSDistantObject.h
NSDistributedLock.h
NSDistributedNotificationCenter.h
NSEnumerator.h
NSError.h
NSException.h
NSExpression.h
NSFileHandle.h
NSFileManager.h
NSFormatter.h
NSGarbageCollector.h
NSGeometry.h
NSHFSFileTypes.h
NSHTTPCookie.h
NSHTTPCookieStorage.h
NSHashTable.h
NSHost.h
NSIndexPath.h
NSIndexSet.h
NSInvocation.h
NSJavaSetup.h
NSKeyValueCoding.h
NSKeyValueObserving.h
NSKeyedArchiver.h
NSLocale.h
NSLock.h
NSMapTable.h
NSMetadata.h
NSMethodSignature.h
NSNetServices.h
NSNotification.h
NSNotificationQueue.h
NSNull.h
NSNumberFormatter.h
NSObjCRuntime.h
NSObject.h
NSObjectScripting.h
NSOperation.h
NSPathUtilities.h
NSPointerArray.h
NSPointerFunctions.h
NSPort.h
NSPortCoder.h
NSPortMessage.h
NSPortNameServer.h
NSPredicate.h
NSProcessInfo.h
NSPropertyList.h
NSProtocolChecker.h
NSProxy.h
NSRange.h
NSRunLoop.h
NSScanner.h
NSScriptClassDescription.h
NSScriptCoercionHandler.h
NSScriptCommand.h
NSScriptCommandDescription.h
NSScriptExecutionContext.h
NSScriptKeyValueCoding.h
NSScriptObjectSpecifiers.h
NSScriptStandardSuiteCommands.h
NSScriptSuiteRegistry.h
NSScriptWhoseTests.h
NSSerialization.h
NSSet.h
NSSortDescriptor.h
NSSpellServer.h
NSStream.h
NSString.h
NSTask.h
NSThread.h
NSTimeZone.h
NSTimer.h
NSURL.h
NSURLAuthenticationChallenge.h
NSURLCache.h
NSURLConnection.h
NSURLCredential.h
NSURLCredentialStorage.h
NSURLDownload.h
NSURLError.h
NSURLHandle.h
NSURLProtectionSpace.h
NSURLProtocol.h
NSURLRequest.h
NSURLResponse.h
NSUndoManager.h
NSUserDefaults.h
NSValue.h
NSValueTransformer.h
NSXMLDTD.h
NSXMLDTDNode.h
NSXMLDocument.h
NSXMLElement.h
NSXMLNode.h
NSXMLNodeOptions.h
NSXMLParser.h
NSZone.h
QTKitDefines.h

Introduction

The Foundation framework defines a base layer of Objective-C classes. In addition to providing a set of useful primitive object classes, it introduces several paradigms that define functionality not covered by the Objective-C language. The Foundation framework is designed with these goals in mind:

The Foundation framework includes the root object class, classes representing basic data types such as strings and byte arrays, collection classes for storing other objects, classes representing system information such as dates, and classes representing communication ports. See Figure I-1 for a list of those classes that make up the Foundation framework.

The Foundation framework introduces several paradigms to avoid confusion in common situations, and to introduce a level of consistency across class hierarchies. This consistency is done with some standard policies, such as that for object ownership (that is, who is responsible for disposing of objects), and with abstract classes like NSEnumerator. These new paradigms reduce the number of special and exceptional cases in an API and allow you to code more efficiently by reusing the same mechanisms with various kinds of objects.

Foundation Framework Classes

The Foundation class hierarchy is rooted in the Foundation framework’s NSObject class (see Figure I-1). The remainder of the Foundation framework consists of several related groups of classes as well as a few individual classes. Many of the groups form what are called class clusters—abstract classes that work as umbrella interfaces to a versatile set of private subclasses. NSString and NSMutableString, for example, act as brokers for instances of various private subclasses optimized for different kinds of storage needs. Depending on the method you use to create a string, an instance of the appropriate optimized class will be returned to you.

Note: In the following class-hierarchy diagrams, blue-shaded areas include classes that are available in Mac OS X and iPhone OS; gray-shaded areas include classes that are available in Mac OS X only.


Figure I-1  Cocoa Objective-C Hierarchy for Foundation

Cocoa Objective-C Hierarchy for Foundation


Class hierarchy diagram for Foundation (part 2)


Class hierarchy diagram for Foundation (part 3)

Many of these classes have closely related functionality:





© 1997, 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-06-27)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.