Classes Protocols Other Reference
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:
-
Provide a small set of basic utility classes.
-
Make software development easier by introducing consistent conventions for things such as deallocation.
-
Support Unicode strings, object persistence, and object distribution.
-
Provide a level of OS independence, to enhance portability.
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 Cocoa Objective-C Hierarchy for Foundation 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. 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.
Many of these classes have closely related functionality:
-
Data Storage:
NSData
provides object-oriented storage for arrays of bytes.NSValue
andNSNumber
provide object-oriented storage for arrays of simple C data values.NSArray
,NSDictionary
, andNSSet
provide storage for Objective-C objects of any class.See Number and Value Programming Topics and Collections Programming Topics for more information.
-
Text and Strings: The
NSString
andNSMutableString
classes represent text strings and provide methods for searching, combining, and comparing strings. AnNSScanner
object is used to scan numbers and words from anNSString
object.NSCharacterSet
represents various groupings of characters that are used byNSString
andNSScanner
.See String Programming Guide for more information.
-
Dates and Times: The
NSDate
,NSTimeZone
, andNSCalendar
classes store times and dates and represent calendrical information. They offer methods for calculating date and time differences. Together withNSLocale
, they provide methods for displaying dates and times in many formats, and for adjusting times and dates based on location in the world.See Date and Time Programming Guide for more information.
-
Sorting and Filtering: Collections of Objective-C objects, such as
NSArray
,NSDictionary
, andNSSet
, can be filtered by anNSPredicate
object, and sorted by one or moreNSSortDescriptor
objects.See Sort Descriptor Programming Topics and Predicate Programming Guide for more information.
-
Application Coordination and Timing:
NSNotification
,NSNotificationCenter
, andNSNotificationQueue
provide systems that an object can use to notify all interested observers of changes that occur. You can use anNSTimer
object to send a message to another object at specific intervals.See Notification Programming Topics for more information.
-
Object Distribution and Persistence: The data that an object contains can be represented in an architecture-independent way using
NSPropertyListSerialization
andNSJSONSerialization
. TheNSCoder
class and its subclasses take this process a step further by allowing class information to be stored along with the data. The resulting representations are used for archiving and for object distribution.See Archives and Serializations Programming Guide for more information.
-
Operating-System Services: Several classes are designed to insulate you from the idiosyncrasies of various operating systems.
NSFileManager
provides a consistent interface for file operations (creating, renaming, deleting, and so on).NSThread
andNSProcessInfo
let you create multithreaded applications and query the environment in which an application runs.See File System Programming Guide for more information.
-
URL Loading System: A set of classes and protocols that allow your app to access content referenced by a URL, as represented by the
NSURL
class.NSURLRequest
andNSURLResponse
objects represent requests and responses sent and received by anNSURLSession
object. Additional functionality is provided by helper classes, includingNSURLProtocol
for protocol support,NSURLAuthenticationChallenge
andNSURLCredentialStorage
for authentication and credentials,NSHTTPCookieStorage
for cookie storage, andNSURLCache
for cache management.See URL Session Programming Guide for more information.
Classes
NSObject is the root class of most Objective-C class hierarchies. | |
NSArray and its subclass NSMutableArray manage ordered collections of objects called arrays. | |
The NSMutableArray class declares the programmatic interface to objects that manage a modifiable array of objects. | |
NSAssertionHandler objects are automatically created to handle false assertions. | |
An NSAttributedString object manages character strings and associated sets of attributes (for example, font and kerning) that apply to individual characters or ranges of characters in the string. | |
NSMutableAttributedString declares the programmatic interface to objects that manage mutable attributed strings. | |
The NSAutoreleasePool class is used to support Cocoa’s reference-counted memory management system. | |
An NSBundle object represents a location in the file system that groups code and resources that can be used in a program. | |
An NSBundleResourceRequest object manages the availability of on-demand resources. | |
An NSCache object is a collection-like container, or cache, that stores key-value pairs, similar to the NSDictionary class. | |
An NSCachedURLResponse object represents a cached response to a URL request. | |
Calendars encapsulate information about systems of reckoning time in which the beginning, length, and divisions of a year are defined. | |
An NSCharacterSet object represents a set of Unicode-compliant characters. | |
The NSMutableCharacterSet class declares the programmatic interface to objects that manage a modifiable set of Unicode characters. | |
The NSCoder abstract class declares the interface used by concrete subclasses to transfer objects and other values between memory and some other format. | |
NSKeyedArchiver, a concrete subclass of NSCoder, provides a way to encode objects (and scalar values) into an architecture-independent format that can be stored in a file. | |
NSKeyedUnarchiver, a concrete subclass of NSCoder, defines methods for decoding a set of named objects (and scalar values) from a keyed archive. | |
The NSCondition class implements a condition variable whose semantics follow those used for POSIX-style conditions. | |
The NSConditionLock class defines objects whose locks can be associated with specific, user-defined conditions. | |
NSData and its mutable subclass NSMutableData provide data objects, object-oriented wrappers for byte buffers. | |
NSMutableData (and its superclass NSData) provide data objects, object-oriented wrappers for byte buffers. | |
You should use the NSPurgeableData class when you have objects with bytes that can be discarded when no longer needed. | |
NSDate objects encapsulate a single point in time, independent of any particular calendrical system or time zone. | |
NSDateComponents encapsulates the components of a date in an extendable, object-oriented manner. | |
NSDecimalNumberHandler is a class that adopts the NSDecimalNumberBehaviors protocol. | |
The NSDictionary class declares the programmatic interface to objects that manage immutable associations of keys and values. | |
The NSMutableDictionary class declares the programmatic interface to objects that manage mutable associations of keys and values. | |
NSEnumerator is an abstract class, instances of whose subclasses enumerate collections of other objects, such as arrays and dictionaries. | |
An NSDirectoryEnumerator object enumerates the contents of a directory, returning the pathnames of all files and directories contained within that directory. | |
An NSError object encapsulates information about an error condition in an extendable, object-oriented manner. | |
NSException is used to implement exception handling and contains information about an exception. | |
NSExpression is used to represent expressions in a predicate. | |
An NSExtensionContext object represents the host app context from which an app extension is invoked. | |
An NSExtensionItem object is an immutable collection of values representing different aspects of an item for the extension to act upon. | |
The NSFileAccessIntent class stores the details of coordinated-read and coordinated-write operations. | |
The NSFileCoordinator class coordinates the reading and writing of files and directories among multiple processes and objects in the same process. | |
The NSFileHandle class is an object-oriented wrapper for a file descriptor. | |
An NSFileManager object lets you examine the contents of the file system and make changes to it. | |
The NSFileSecurity class is an Objective-C stub class that is transparently bridged to CFFileSecurity. | |
An NSFileVersion object represents a snapshot of a file at a specific point in time. | |
The NSFileWrapper class provides access to the attributes and contents of file-system nodes. | |
NSFormatter is an abstract class that declares an interface for objects that create, interpret, and validate the textual representation of values. | |
The NSByteCountFormatter class converts a byte count value into a textual representation that is formatted with the appropriate byte modifier (KB, MB, GB and so on). | |
An NSDateComponentsFormatter object takes quantities of time and formats them as a user-readable string. | |
Instances of NSDateFormatter create string representations of NSDate objects, and convert textual representations of dates and times into NSDate objects. | |
An NSDateIntervalFormatter object creates user-readable strings from pairs of dates. | |
The NSEnergyFormatter class provides properly formatted, localized descriptions of energy values. | |
The NSLengthFormatter class provides properly formatted, localized descriptions of linear distances (for example, length and height measurements). | |
The NSMassFormatter class provides properly formatted, localized descriptions of mass and weight values. | |
Instances of NSNumberFormatter format the textual representation of cells that contain NSNumber objects and convert textual representations of numeric values into NSNumber objects. | |
The NSPersonNameComponentsFormatter class provides properly formatted, localized representations of the components of a person’s name. | |
An NSHTTPCookie object represents an HTTP cookie. | |
NSHTTPCookieStorage implements a singleton object (shared instance) that manages storage of cookies. | |
NSHashTable is modeled after NSSet but provides different options, in particular to support weak relationships. | |
The NSIndexPath class represents the path to a specific node in a tree of nested array collections. | |
The NSIndexSet class represents an immutable collection of unique unsigned integers, known as indexes because of the way they are used. | |
The NSMutableIndexSet class represents a mutable collection of unique unsigned integers, known as indexes because of the way they are used. | |
An NSInvocation is an Objective-C message rendered static, that is, it is an action turned into an object. | |
An NSItemProvider object provides a lazy and secure way to convey data between a host app and extension. | |
You use the NSJSONSerialization class to convert JSON to Foundation objects and convert Foundation objects to JSON. | |
The NSLinguisticTagger class is used to automatically segment natural-language text and tag it with information, such as parts of speech. | |
Locales encapsulate information about linguistic, cultural, and technological conventions and standards. | |
An NSLock object is used to coordinate the operation of multiple threads of execution within the same application. | |
NSMapTable is a mutable collection modeled after NSDictionary but provides different options. | |
The NSMetadataItem class represents the metadata associated with a file, providing a simple interface to retrieve the available attribute names and values. | |
The NSMetadataQuery class encapsulates the functionality provided by the MDQuery opaque type for querying the Spotlight metadata. | |
The NSMetadataQueryAttributeValueTuple class represents attribute-value tuples, which are objects that contain the attribute name and value of a metadata attribute. | |
The NSMetadataQueryResultGroup class represents a collection of grouped attribute results returned by an NSMetadataQuery object. | |
An NSMethodSignature object records type information for the arguments and return value of a method. | |
The NSNetService class represents a network service, either one your application publishes or is a client of. | |
The NSNetServiceBrowser class defines an interface for finding published services on a network using multicast DNS. | |
NSNotification objects encapsulate information so that it can be broadcast to other objects by an NSNotificationCenter object. | |
An NSNotificationCenter object (or simply, notification center) provides a mechanism for broadcasting information within a program. | |
NSNotificationQueue objects (or simply notification queues) act as buffers for notification centers (instances of NSNotificationCenter). | |
The NSNull class defines a singleton object used to represent null values in collection objects (which don’t allow nil values). | |
The NSOperation class is an abstract class you use to encapsulate the code and data associated with a single task. | |
The NSBlockOperation class is a concrete subclass of NSOperation that manages the concurrent execution of one or more blocks. | |
The NSInvocationOperation class is a concrete subclass of NSOperation that manages the execution of a single encapsulated task specified as an invocation. | |
The NSOperationQueue class regulates the execution of a set of NSOperation objects. | |
NSOrderedSet and its subclass, NSMutableOrderedSet, declare the programmatic interfaces to an ordered collection of objects. | |
NSMutableOrderedSet class declares the programmatic interface to a mutable, ordered collection of distinct objects. | |
The NSOrthography class describes the linguistic content of a piece of text, typically used for the purposes of spelling and grammar checking. | |
An NSPersonNameComponents object encapsulates the components of a person's name in an extendable, object-oriented manner. | |
NSPipe objects provide an object-oriented interface for accessing pipes. | |
NSPointerArray is a mutable collection modeled after NSArray but it can also hold NULL values, which can be inserted or extracted (and which contribute to the object’s count). | |
An instance of NSPointerFunctions defines callout functions appropriate for managing a pointer reference held somewhere else. | |
NSPort is an abstract class that represents a communication channel. | |
NSMachPort is a subclass of NSPort that can be used as an endpoint for distributed object connections (or raw messaging). | |
NSMessagePort is a subclass of NSPort that can be used as an endpoint for distributed object connections (or raw messaging). | |
The NSPredicate class is used to define logical conditions used to constrain a search either for a fetch or for in-memory filtering. | |
NSComparisonPredicate is a subclass of NSPredicate that you use to compare expressions. | |
NSCompoundPredicate is a subclass of NSPredicate used to represent logical “gate” operations (AND/OR/NOT) and comparison operations. | |
The NSProcessInfo class provides methods to access information about the current process. | |
The NSProgress class provides a self-contained mechanism for progress reporting. | |
The NSPropertyListSerialization class provides methods that convert property list objects to and from several serialized formats. | |
NSRecursiveLock defines a lock that may be acquired multiple times by the same thread without causing a deadlock, a situation where a thread is permanently blocked waiting for itself to relinquish a lock. | |
The NSRegularExpression class is used to represent and apply regular expressions to Unicode strings. | |
The NSDataDetector class is a specialized subclass of the NSRegularExpression class designed to match data detectors. | |
The NSRunLoop class declares the programmatic interface to objects that manage input sources. | |
The NSScanner class is an abstract superclass of a class cluster that declares the programmatic interface for an object that scans values from an NSString object. | |
The NSSet, NSMutableSet, and NSCountedSet classes declare the programmatic interface to an unordered collection of objects. | |
The NSMutableSet class declares the programmatic interface to a mutable, unordered collection of distinct objects. | |
The NSCountedSet class declares the programmatic interface to a mutable, unordered collection of indistinct objects. | |
An instance of NSSortDescriptor describes a basis for ordering objects by specifying the property to use to compare the objects, the method to use to compare the properties, and whether the comparison should be ascending or descending. | |
NSStream is an abstract class for objects representing streams. | |
NSInputStream is a subclass of NSStream that provides read-only stream functionality. | |
The NSOutputStream class is a subclass of NSStream that provides write-only stream functionality. | |
The NSString class declares the programmatic interface for an object that manages immutable strings. | |
The NSMutableString class declares the programmatic interface to an object that manages a mutable string—that is, a string whose contents can be edited—that conceptually represents an array of Unicode characters. | |
NSTextCheckingResult is a class used to describe items located by text checking. | |
An NSThread object controls a thread of execution. | |
NSTimeZone is an abstract class that defines the behavior of time zone objects. | |
You use the NSTimer class to create timer objects or, more simply, timers. | |
An NSURL object represents a URL that can potentially contain the location of a resource on a remote server, the path of a local file on disk, or even an arbitrary piece of encoded data. | |
NSURLAuthenticationChallenge encapsulates a challenge from a server requiring authentication from the client. | |
The NSURLCache class implements the caching of responses to URL load requests by mapping NSURLRequest objects to NSCachedURLResponse objects. | |
The NSURLComponents class is a class that is designed to parse URLs based on RFC 3986 and to construct URLs from their constituent parts. | |
An NSURLConnection object lets you load the contents of a URL by providing a URL request object. | |
NSURLCredential is an immutable object representing an authentication credential consisting of authentication information specific to the type of credential and the type of persistent storage to use, if any. | |
NSURLCredentialStorage implements a singleton (shared object) that manages the credential storage. | |
An NSURLProtectionSpace object represents a server or an area on a server, commonly referred to as a realm, that requires authentication. | |
An NSURLProtocol object handles the loading of protocol-specific URL data. | |
An NSURLQueryItem object represents a single name/value pair for an item in the query portion of a URL. | |
NSURLRequest objects represent a URL load request in a manner independent of protocol and URL scheme. | |
NSMutableURLRequest is a subclass of NSURLRequest provided to aid developers who may find it more convenient to mutate a single request object for a series of URL load requests instead of creating an immutable NSURLRequest object for each load. | |
The NSURLResponse class encapsulates the metadata associated with the response to a a URL load request in a manner independent of protocol and URL scheme. | |
The NSHTTPURLResponse class is a subclass of NSURLResponse that provides methods for accessing information specific to HTTP protocol responses. | |
The NSURLSession class and related classes provide an API for downloading content. | |
An NSURLSessionConfiguration object defines the behavior and policies to use when uploading and downloading data using an NSURLSession object. | |
The NSURLSessionTask class is the base class for tasks in a URL session. | |
An NSURLSessionDataTask is a concrete subclass of NSURLSessionTask. | |
The NSURLSessionUploadTask class is a subclass of NSURLSessionDataTask, which in turn is a concrete subclass of NSURLSessionTask. | |
An NSURLSessionDownloadTask is a concrete subclass of NSURLSessionTask. | |
|
|
The NSUUID class creates UUID strings that are to uniquely identify types, interfaces, and other items. | |
Use the iCloud key-value store to make preference, configuration, and app-state data available to every instance of your app on every device connected to a user’s iCloud account. | |
NSUndoManager is a general-purpose recorder of operations for undo and redo. | |
An NSUserActivity object provides a lightweight way to capture app state so that it can be restored later. | |
The NSUserDefaults class provides a programmatic interface for interacting with the defaults system. | |
An NSValue object is a simple container for a single C or Objective-C data item. | |
NSNumber is a subclass of NSValue that offers a value as any C scalar (numeric) type. | |
NSDecimalNumber, an immutable subclass of NSNumber, provides an object-oriented wrapper for doing base-10 arithmetic. | |
NSValueTransformer is an abstract class that is used by the Cocoa Bindings technology to transform values from one representation to another. | |
Instances of this class parse XML documents (including DTD declarations) in an event-driven manner. | |
NSProxy is an abstract superclass defining an API for objects that act as stand-ins for other objects or for objects that don’t exist yet. |
Protocols
The delegate of an NSCache object implements this protocol to perform specialized actions when an object is about to be evicted or removed from the cache. | |
The NSCoding protocol declares the two methods that a class must implement so that instances of that class can be encoded and decoded. | |
The NSCopying protocol declares a method for providing functional copies of an object. | |
The NSDecimalBehaviors protocol declares three methods that control the discretionary aspects of working with NSDecimalNumber objects. | |
You implement this protocol when a class’s objects have subcomponents that can be discarded when not being used, thereby giving an application a smaller memory footprint. | |
The NSErrorRecoveryAttempting informal protocol provides methods that allow your application to attempt to recover from an error. | |
The NSExtensionRequestHandling protocol provides a life cycle hook into an app extension. | |
The fast enumeration protocol NSFastEnumeration must be adopted and implemented by objects used in conjunction with the for language construct used in conjunction with Cocoa objects. | |
The NSFileManagerDelegate protocol defines optional methods for managing operations involving the copying, moving, linking, or removal of files and directories. | |
The NSFilePresenter protocol should be implemented by objects that allow the user to view or edit the content of files or directories. | |
The NSKeyValueCoding informal protocol defines a mechanism by which you can access the properties of an object indirectly by name (or key), rather than directly through invocation of an accessor method or as instance variables. | |
The NSKeyValueObserving (KVO) informal protocol defines a mechanism that allows objects to be notified of changes to the specified properties of other objects. | |
The NSKeyedArchiverDelegate protocol defines the optional methods implemented by delegates of NSKeyedArchiver objects. | |
The NSKeyedUnarchiverDelegate protocol defines the optional methods implemented by delegates of NSKeyedUnarchiver objects. | |
The NSLocking protocol declares the elementary methods adopted by classes that define lock objects. | |
The NSMachPortDelegate protocol defines the optional methods implemented by delegates of NSMachPort objects. | |
The NSMetadataQueryDelegate protocol defines the optional methods implemented by delegates of NSMetadataQuery objects. | |
The NSMutableCopying protocol declares a method for providing mutable copies of an object. | |
The NSNetServiceBrowserDelegate protocol defines the optional methods implemented by delegates of NSNetServiceBrowser objects. | |
The NSNetServiceDelegate protocol defines the optional methods implemented by delegates of NSNetService objects. | |
The NSObject protocol groups methods that are fundamental to all Objective-C objects. | |
The NSPortDelegate protocol defines the optional methods implemented by delegates of NSPort objects. | |
Implement the NSProgressReporting protocol to report progress for classes that return only one progress object. | |
Conforming to the NSSecureCoding protocol indicates that an object handles encoding and decoding instances of itself in a manner that is robust against object substitution attacks. | |
The NSStreamDelegate protocol defines the optional methods implemented by delegates of NSStream objects. | |
The NSURLAuthenticationChallengeSender protocol represents the interface that the sender of an authentication challenge must implement. | |
The NSURLConnectionDataDelegate protocol describes methods that should be implemented by the delegate for an instance of the NSURLConnection class. | |
The NSURLConnectionDelegate protocol defines methods common to the NSURLConnectionDataDelegate and NSURLConnectionDownloadDelegate protocols. | |
The NSURLConnectionDownloadDelegate protocol describes methods that should be implemented by the delegate of instances of NSURLConnection created using Newsstand Kit’s downloadWithDelegate: method. | |
The NSURLProtocolClient protocol provides the interface used by NSURLProtocol subclasses to communicate with the URL loading system. | |
The NSURLSessionDataDelegate protocol defines the methods that a delegate of an NSURLSession object can implement to handle task-level events specific to data tasks and upload tasks. | |
The NSURLSessionDelegate protocol describes the methods that NSURLSession objects call on their delegates to handle session-level events. | |
The NSURLSessionDownloadDelegate protocol defines delegate methods that you should implement when using NSURLSession download tasks. | |
|
|
The NSURLSessionTaskDelegate protocol defines the task-specific delegate methods that you should implement when working with any type of NSURLSession task. | |
An object conforming to the NSUserActivityDelegate protocol works with an NSUserActivity object, which encapsulates the state of a user activity in an application on a particular device and enables the same activity to be continued on another device. | |
The NSXMLParserDelegate protocol defines the optional methods implemented by delegates of NSXMLParser objects. |
Other Reference
Classes Protocols Other Reference
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:
-
Provide a small set of basic utility classes.
-
Make software development easier by introducing consistent conventions for things such as deallocation.
-
Support Unicode strings, object persistence, and object distribution.
-
Provide a level of OS independence, to enhance portability.
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 Cocoa Objective-C Hierarchy for Foundation 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. 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.
Many of these classes have closely related functionality:
-
Data Storage:
NSData
provides object-oriented storage for arrays of bytes.NSValue
andNSNumber
provide object-oriented storage for arrays of simple C data values.NSArray
,NSDictionary
, andNSSet
provide storage for Objective-C objects of any class.See Number and Value Programming Topics and Collections Programming Topics for more information.
-
Text and Strings: The
NSString
andNSMutableString
classes represent text strings and provide methods for searching, combining, and comparing strings. AnNSScanner
object is used to scan numbers and words from anNSString
object.NSCharacterSet
represents various groupings of characters that are used byNSString
andNSScanner
.See String Programming Guide for more information.
-
Dates and Times: The
NSDate
,NSTimeZone
, andNSCalendar
classes store times and dates and represent calendrical information. They offer methods for calculating date and time differences. Together withNSLocale
, they provide methods for displaying dates and times in many formats, and for adjusting times and dates based on location in the world.See Date and Time Programming Guide for more information.
-
Sorting and Filtering: Collections of Objective-C objects, such as
NSArray
,NSDictionary
, andNSSet
, can be filtered by anNSPredicate
object, and sorted by one or moreNSSortDescriptor
objects.See Sort Descriptor Programming Topics and Predicate Programming Guide for more information.
-
Application Coordination and Timing:
NSNotification
,NSNotificationCenter
, andNSNotificationQueue
provide systems that an object can use to notify all interested observers of changes that occur. You can use anNSTimer
object to send a message to another object at specific intervals.See Notification Programming Topics for more information.
-
Object Distribution and Persistence: The data that an object contains can be represented in an architecture-independent way using
NSPropertyListSerialization
andNSJSONSerialization
. TheNSCoder
class and its subclasses take this process a step further by allowing class information to be stored along with the data. The resulting representations are used for archiving and for object distribution.See Archives and Serializations Programming Guide for more information.
-
Operating-System Services: Several classes are designed to insulate you from the idiosyncrasies of various operating systems.
NSFileManager
provides a consistent interface for file operations (creating, renaming, deleting, and so on).NSThread
andNSProcessInfo
let you create multithreaded applications and query the environment in which an application runs.See File System Programming Guide for more information.
-
URL Loading System: A set of classes and protocols that allow your app to access content referenced by a URL, as represented by the
NSURL
class.NSURLRequest
andNSURLResponse
objects represent requests and responses sent and received by anNSURLSession
object. Additional functionality is provided by helper classes, includingNSURLProtocol
for protocol support,NSURLAuthenticationChallenge
andNSURLCredentialStorage
for authentication and credentials,NSHTTPCookieStorage
for cookie storage, andNSURLCache
for cache management.See URL Session Programming Guide for more information.
Classes
NSObject is the root class of most Objective-C class hierarchies. | |
NSArray and its subclass NSMutableArray manage ordered collections of objects called arrays. | |
The NSMutableArray class declares the programmatic interface to objects that manage a modifiable array of objects. | |
NSAssertionHandler objects are automatically created to handle false assertions. | |
An NSAttributedString object manages character strings and associated sets of attributes (for example, font and kerning) that apply to individual characters or ranges of characters in the string. | |
NSMutableAttributedString declares the programmatic interface to objects that manage mutable attributed strings. | |
The NSAutoreleasePool class is used to support Cocoa’s reference-counted memory management system. | |
An NSBundle object represents a location in the file system that groups code and resources that can be used in a program. | |
An NSBundleResourceRequest object manages the availability of on-demand resources. | |
An NSCache object is a collection-like container, or cache, that stores key-value pairs, similar to the NSDictionary class. | |
An NSCachedURLResponse object represents a cached response to a URL request. | |
Calendars encapsulate information about systems of reckoning time in which the beginning, length, and divisions of a year are defined. | |
An NSCharacterSet object represents a set of Unicode-compliant characters. | |
The NSMutableCharacterSet class declares the programmatic interface to objects that manage a modifiable set of Unicode characters. | |
The NSCoder abstract class declares the interface used by concrete subclasses to transfer objects and other values between memory and some other format. | |
NSKeyedArchiver, a concrete subclass of NSCoder, provides a way to encode objects (and scalar values) into an architecture-independent format that can be stored in a file. | |
NSKeyedUnarchiver, a concrete subclass of NSCoder, defines methods for decoding a set of named objects (and scalar values) from a keyed archive. | |
The NSCondition class implements a condition variable whose semantics follow those used for POSIX-style conditions. | |
The NSConditionLock class defines objects whose locks can be associated with specific, user-defined conditions. | |
NSData and its mutable subclass NSMutableData provide data objects, object-oriented wrappers for byte buffers. | |
NSMutableData (and its superclass NSData) provide data objects, object-oriented wrappers for byte buffers. | |
You should use the NSPurgeableData class when you have objects with bytes that can be discarded when no longer needed. | |
NSDate objects encapsulate a single point in time, independent of any particular calendrical system or time zone. | |
NSDateComponents encapsulates the components of a date in an extendable, object-oriented manner. | |
NSDecimalNumberHandler is a class that adopts the NSDecimalNumberBehaviors protocol. | |
The NSDictionary class declares the programmatic interface to objects that manage immutable associations of keys and values. | |
The NSMutableDictionary class declares the programmatic interface to objects that manage mutable associations of keys and values. | |
NSEnumerator is an abstract class, instances of whose subclasses enumerate collections of other objects, such as arrays and dictionaries. | |
An NSDirectoryEnumerator object enumerates the contents of a directory, returning the pathnames of all files and directories contained within that directory. | |
An NSError object encapsulates information about an error condition in an extendable, object-oriented manner. | |
NSException is used to implement exception handling and contains information about an exception. | |
NSExpression is used to represent expressions in a predicate. | |
An NSExtensionContext object represents the host app context from which an app extension is invoked. | |
An NSExtensionItem object is an immutable collection of values representing different aspects of an item for the extension to act upon. | |
The NSFileAccessIntent class stores the details of coordinated-read and coordinated-write operations. | |
The NSFileCoordinator class coordinates the reading and writing of files and directories among multiple processes and objects in the same process. | |
The NSFileHandle class is an object-oriented wrapper for a file descriptor. | |
An NSFileManager object lets you examine the contents of the file system and make changes to it. | |
The NSFileSecurity class is an Objective-C stub class that is transparently bridged to CFFileSecurity. | |
An NSFileVersion object represents a snapshot of a file at a specific point in time. | |
The NSFileWrapper class provides access to the attributes and contents of file-system nodes. | |
NSFormatter is an abstract class that declares an interface for objects that create, interpret, and validate the textual representation of values. | |
The NSByteCountFormatter class converts a byte count value into a textual representation that is formatted with the appropriate byte modifier (KB, MB, GB and so on). | |
An NSDateComponentsFormatter object takes quantities of time and formats them as a user-readable string. | |
Instances of NSDateFormatter create string representations of NSDate objects, and convert textual representations of dates and times into NSDate objects. | |
An NSDateIntervalFormatter object creates user-readable strings from pairs of dates. | |
The NSEnergyFormatter class provides properly formatted, localized descriptions of energy values. | |
The NSLengthFormatter class provides properly formatted, localized descriptions of linear distances (for example, length and height measurements). | |
The NSMassFormatter class provides properly formatted, localized descriptions of mass and weight values. | |
Instances of NSNumberFormatter format the textual representation of cells that contain NSNumber objects and convert textual representations of numeric values into NSNumber objects. | |
The NSPersonNameComponentsFormatter class provides properly formatted, localized representations of the components of a person’s name. | |
An NSHTTPCookie object represents an HTTP cookie. | |
NSHTTPCookieStorage implements a singleton object (shared instance) that manages storage of cookies. | |
NSHashTable is modeled after NSSet but provides different options, in particular to support weak relationships. | |
The NSIndexPath class represents the path to a specific node in a tree of nested array collections. | |
The NSIndexSet class represents an immutable collection of unique unsigned integers, known as indexes because of the way they are used. | |
The NSMutableIndexSet class represents a mutable collection of unique unsigned integers, known as indexes because of the way they are used. | |
An NSInvocation is an Objective-C message rendered static, that is, it is an action turned into an object. | |
An NSItemProvider object provides a lazy and secure way to convey data between a host app and extension. | |
You use the NSJSONSerialization class to convert JSON to Foundation objects and convert Foundation objects to JSON. | |
The NSLinguisticTagger class is used to automatically segment natural-language text and tag it with information, such as parts of speech. | |
Locales encapsulate information about linguistic, cultural, and technological conventions and standards. | |
An NSLock object is used to coordinate the operation of multiple threads of execution within the same application. | |
NSMapTable is a mutable collection modeled after NSDictionary but provides different options. | |
The NSMetadataItem class represents the metadata associated with a file, providing a simple interface to retrieve the available attribute names and values. | |
The NSMetadataQuery class encapsulates the functionality provided by the MDQuery opaque type for querying the Spotlight metadata. | |
The NSMetadataQueryAttributeValueTuple class represents attribute-value tuples, which are objects that contain the attribute name and value of a metadata attribute. | |
The NSMetadataQueryResultGroup class represents a collection of grouped attribute results returned by an NSMetadataQuery object. | |
An NSMethodSignature object records type information for the arguments and return value of a method. | |
The NSNetService class represents a network service, either one your application publishes or is a client of. | |
The NSNetServiceBrowser class defines an interface for finding published services on a network using multicast DNS. | |
NSNotification objects encapsulate information so that it can be broadcast to other objects by an NSNotificationCenter object. | |
An NSNotificationCenter object (or simply, notification center) provides a mechanism for broadcasting information within a program. | |
NSNotificationQueue objects (or simply notification queues) act as buffers for notification centers (instances of NSNotificationCenter). | |
The NSNull class defines a singleton object used to represent null values in collection objects (which don’t allow nil values). | |
The NSOperation class is an abstract class you use to encapsulate the code and data associated with a single task. | |
The NSBlockOperation class is a concrete subclass of NSOperation that manages the concurrent execution of one or more blocks. | |
The NSInvocationOperation class is a concrete subclass of NSOperation that manages the execution of a single encapsulated task specified as an invocation. | |
The NSOperationQueue class regulates the execution of a set of NSOperation objects. | |
NSOrderedSet and its subclass, NSMutableOrderedSet, declare the programmatic interfaces to an ordered collection of objects. | |
NSMutableOrderedSet class declares the programmatic interface to a mutable, ordered collection of distinct objects. | |
The NSOrthography class describes the linguistic content of a piece of text, typically used for the purposes of spelling and grammar checking. | |
An NSPersonNameComponents object encapsulates the components of a person's name in an extendable, object-oriented manner. | |
NSPipe objects provide an object-oriented interface for accessing pipes. | |
NSPointerArray is a mutable collection modeled after NSArray but it can also hold NULL values, which can be inserted or extracted (and which contribute to the object’s count). | |
An instance of NSPointerFunctions defines callout functions appropriate for managing a pointer reference held somewhere else. | |
NSPort is an abstract class that represents a communication channel. | |
NSMachPort is a subclass of NSPort that can be used as an endpoint for distributed object connections (or raw messaging). | |
NSMessagePort is a subclass of NSPort that can be used as an endpoint for distributed object connections (or raw messaging). | |
The NSPredicate class is used to define logical conditions used to constrain a search either for a fetch or for in-memory filtering. | |
NSComparisonPredicate is a subclass of NSPredicate that you use to compare expressions. | |
NSCompoundPredicate is a subclass of NSPredicate used to represent logical “gate” operations (AND/OR/NOT) and comparison operations. | |
The NSProcessInfo class provides methods to access information about the current process. | |
The NSProgress class provides a self-contained mechanism for progress reporting. | |
The NSPropertyListSerialization class provides methods that convert property list objects to and from several serialized formats. | |
NSRecursiveLock defines a lock that may be acquired multiple times by the same thread without causing a deadlock, a situation where a thread is permanently blocked waiting for itself to relinquish a lock. | |
The NSRegularExpression class is used to represent and apply regular expressions to Unicode strings. | |
The NSDataDetector class is a specialized subclass of the NSRegularExpression class designed to match data detectors. | |
The NSRunLoop class declares the programmatic interface to objects that manage input sources. | |
The NSScanner class is an abstract superclass of a class cluster that declares the programmatic interface for an object that scans values from an NSString object. | |
The NSSet, NSMutableSet, and NSCountedSet classes declare the programmatic interface to an unordered collection of objects. | |
The NSMutableSet class declares the programmatic interface to a mutable, unordered collection of distinct objects. | |
The NSCountedSet class declares the programmatic interface to a mutable, unordered collection of indistinct objects. | |
An instance of NSSortDescriptor describes a basis for ordering objects by specifying the property to use to compare the objects, the method to use to compare the properties, and whether the comparison should be ascending or descending. | |
NSStream is an abstract class for objects representing streams. | |
NSInputStream is a subclass of NSStream that provides read-only stream functionality. | |
The NSOutputStream class is a subclass of NSStream that provides write-only stream functionality. | |
The NSString class declares the programmatic interface for an object that manages immutable strings. | |
The NSMutableString class declares the programmatic interface to an object that manages a mutable string—that is, a string whose contents can be edited—that conceptually represents an array of Unicode characters. | |
NSTextCheckingResult is a class used to describe items located by text checking. | |
An NSThread object controls a thread of execution. | |
NSTimeZone is an abstract class that defines the behavior of time zone objects. | |
You use the NSTimer class to create timer objects or, more simply, timers. | |
An NSURL object represents a URL that can potentially contain the location of a resource on a remote server, the path of a local file on disk, or even an arbitrary piece of encoded data. | |
NSURLAuthenticationChallenge encapsulates a challenge from a server requiring authentication from the client. | |
The NSURLCache class implements the caching of responses to URL load requests by mapping NSURLRequest objects to NSCachedURLResponse objects. | |
The NSURLComponents class is a class that is designed to parse URLs based on RFC 3986 and to construct URLs from their constituent parts. | |
An NSURLConnection object lets you load the contents of a URL by providing a URL request object. | |
NSURLCredential is an immutable object representing an authentication credential consisting of authentication information specific to the type of credential and the type of persistent storage to use, if any. | |
NSURLCredentialStorage implements a singleton (shared object) that manages the credential storage. | |
An NSURLProtectionSpace object represents a server or an area on a server, commonly referred to as a realm, that requires authentication. | |
An NSURLProtocol object handles the loading of protocol-specific URL data. | |
An NSURLQueryItem object represents a single name/value pair for an item in the query portion of a URL. | |
NSURLRequest objects represent a URL load request in a manner independent of protocol and URL scheme. | |
NSMutableURLRequest is a subclass of NSURLRequest provided to aid developers who may find it more convenient to mutate a single request object for a series of URL load requests instead of creating an immutable NSURLRequest object for each load. | |
The NSURLResponse class encapsulates the metadata associated with the response to a a URL load request in a manner independent of protocol and URL scheme. | |
The NSHTTPURLResponse class is a subclass of NSURLResponse that provides methods for accessing information specific to HTTP protocol responses. | |
The NSURLSession class and related classes provide an API for downloading content. | |
An NSURLSessionConfiguration object defines the behavior and policies to use when uploading and downloading data using an NSURLSession object. | |
The NSURLSessionTask class is the base class for tasks in a URL session. | |
An NSURLSessionDataTask is a concrete subclass of NSURLSessionTask. | |
The NSURLSessionUploadTask class is a subclass of NSURLSessionDataTask, which in turn is a concrete subclass of NSURLSessionTask. | |
An NSURLSessionDownloadTask is a concrete subclass of NSURLSessionTask. | |
|
|
The NSUUID class creates UUID strings that are to uniquely identify types, interfaces, and other items. | |
Use the iCloud key-value store to make preference, configuration, and app-state data available to every instance of your app on every device connected to a user’s iCloud account. | |
NSUndoManager is a general-purpose recorder of operations for undo and redo. | |
An NSUserActivity object provides a lightweight way to capture app state so that it can be restored later. | |
The NSUserDefaults class provides a programmatic interface for interacting with the defaults system. | |
An NSValue object is a simple container for a single C or Objective-C data item. | |
NSNumber is a subclass of NSValue that offers a value as any C scalar (numeric) type. | |
NSDecimalNumber, an immutable subclass of NSNumber, provides an object-oriented wrapper for doing base-10 arithmetic. | |
NSValueTransformer is an abstract class that is used by the Cocoa Bindings technology to transform values from one representation to another. | |
Instances of this class parse XML documents (including DTD declarations) in an event-driven manner. | |
NSProxy is an abstract superclass defining an API for objects that act as stand-ins for other objects or for objects that don’t exist yet. |
Protocols
The delegate of an NSCache object implements this protocol to perform specialized actions when an object is about to be evicted or removed from the cache. | |
The NSCoding protocol declares the two methods that a class must implement so that instances of that class can be encoded and decoded. | |
The NSCopying protocol declares a method for providing functional copies of an object. | |
The NSDecimalBehaviors protocol declares three methods that control the discretionary aspects of working with NSDecimalNumber objects. | |
You implement this protocol when a class’s objects have subcomponents that can be discarded when not being used, thereby giving an application a smaller memory footprint. | |
The NSErrorRecoveryAttempting informal protocol provides methods that allow your application to attempt to recover from an error. | |
The NSExtensionRequestHandling protocol provides a life cycle hook into an app extension. | |
The fast enumeration protocol NSFastEnumeration must be adopted and implemented by objects used in conjunction with the for language construct used in conjunction with Cocoa objects. | |
The NSFileManagerDelegate protocol defines optional methods for managing operations involving the copying, moving, linking, or removal of files and directories. | |
The NSFilePresenter protocol should be implemented by objects that allow the user to view or edit the content of files or directories. | |
The NSKeyValueCoding informal protocol defines a mechanism by which you can access the properties of an object indirectly by name (or key), rather than directly through invocation of an accessor method or as instance variables. | |
The NSKeyValueObserving (KVO) informal protocol defines a mechanism that allows objects to be notified of changes to the specified properties of other objects. | |
The NSKeyedArchiverDelegate protocol defines the optional methods implemented by delegates of NSKeyedArchiver objects. | |
The NSKeyedUnarchiverDelegate protocol defines the optional methods implemented by delegates of NSKeyedUnarchiver objects. | |
The NSLocking protocol declares the elementary methods adopted by classes that define lock objects. | |
The NSMachPortDelegate protocol defines the optional methods implemented by delegates of NSMachPort objects. | |
The NSMetadataQueryDelegate protocol defines the optional methods implemented by delegates of NSMetadataQuery objects. | |
The NSMutableCopying protocol declares a method for providing mutable copies of an object. | |
The NSNetServiceBrowserDelegate protocol defines the optional methods implemented by delegates of NSNetServiceBrowser objects. | |
The NSNetServiceDelegate protocol defines the optional methods implemented by delegates of NSNetService objects. | |
The NSObject protocol groups methods that are fundamental to all Objective-C objects. | |
The NSPortDelegate protocol defines the optional methods implemented by delegates of NSPort objects. | |
Implement the NSProgressReporting protocol to report progress for classes that return only one progress object. | |
Conforming to the NSSecureCoding protocol indicates that an object handles encoding and decoding instances of itself in a manner that is robust against object substitution attacks. | |
The NSStreamDelegate protocol defines the optional methods implemented by delegates of NSStream objects. | |
The NSURLAuthenticationChallengeSender protocol represents the interface that the sender of an authentication challenge must implement. | |
The NSURLConnectionDataDelegate protocol describes methods that should be implemented by the delegate for an instance of the NSURLConnection class. | |
The NSURLConnectionDelegate protocol defines methods common to the NSURLConnectionDataDelegate and NSURLConnectionDownloadDelegate protocols. | |
The NSURLConnectionDownloadDelegate protocol describes methods that should be implemented by the delegate of instances of NSURLConnection created using Newsstand Kit’s downloadWithDelegate: method. | |
The NSURLProtocolClient protocol provides the interface used by NSURLProtocol subclasses to communicate with the URL loading system. | |
The NSURLSessionDataDelegate protocol defines the methods that a delegate of an NSURLSession object can implement to handle task-level events specific to data tasks and upload tasks. | |
The NSURLSessionDelegate protocol describes the methods that NSURLSession objects call on their delegates to handle session-level events. | |
The NSURLSessionDownloadDelegate protocol defines delegate methods that you should implement when using NSURLSession download tasks. | |
|
|
The NSURLSessionTaskDelegate protocol defines the task-specific delegate methods that you should implement when working with any type of NSURLSession task. | |
An object conforming to the NSUserActivityDelegate protocol works with an NSUserActivity object, which encapsulates the state of a user activity in an application on a particular device and enables the same activity to be continued on another device. | |
The NSXMLParserDelegate protocol defines the optional methods implemented by delegates of NSXMLParser objects. |