Access the essential classes that define basic object behavior, data types, collections, and operating-system services. Incorporate design patterns and mechanisms that make your apps more efficient and robust.


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:




The NSAffineTransform class provides methods for creating, concatenating, and applying affine transformations.


An instance of NSAppleEventDescriptor represents a descriptor—the basic building block for Apple events. This class is a wrapper for the underlying Apple event descriptor data type, AEDesc. Scriptable Cocoa applications frequently work with instances of NSAppleEventDescriptor, but should rarely need to work directly with the AEDesc data structure.


Provides a mechanism for registering handler routines for specific types of Apple events and dispatching events to those handlers.


The NSAppleScript class provides the ability to load, compile, and execute scripts.


NSArchiver, a concrete subclass of NSCoder, provides a way to encode objects into an architecture-independent format that can be stored in a file. When you archive a graph of objects, the class information and instance variables for each object are written to the archive. NSArchiver's companion class, NSUnarchiver, decodes the data in an archive and creates a graph of objects equivalent to the original set.


NSArray and its subclass NSMutableArray manage ordered collections of objects called arrays. NSArray creates static arrays, and NSMutableArray creates dynamic arrays. You can use arrays when you need an ordered collection of objects.


NSAssertionHandler objects are automatically created to handle false assertions. Assertion macros, such as NSAssert and NSCAssert, are used to evaluate a condition, and, if the condition evaluates to false, the macros pass a string to an NSAssertionHandler object describing the failure. Each thread has its own NSAssertionHandler object. When invoked, an assertion handler prints an error message that includes the method and class (or function) containing the assertion and raises an NSInternalInconsistencyException.


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. An association of characters and their attributes is called an attributed string. The cluster’s two public classes, NSAttributedString and NSMutableAttributedString, declare the programmatic interface for read-only attributed strings and modifiable attributed strings, respectively.


An NSBackgroundActivityScheduler object is used to schedule an arbitrary maintenance or background task. It’s similar to an Timer object, in that it lets you schedule a repeating or nonrepeating task. However, NSBackgroundActivityScheduler gives the system flexibility to determine the most efficient time to execute based on energy usage, thermal conditions, and CPU use.


The NSBlockOperation class is a concrete subclass of Operation that manages the concurrent execution of one or more blocks. You can use this object to execute several blocks at once without having to create separate operation objects for each. When executing more than one block, the operation itself is considered finished only when all blocks have finished executing.


An NSBundle object helps you access the code and resources in a bundle directory on disk. Apple uses bundles to represent apps, frameworks, plug-ins, and many other specific types of content. Bundles organize their contained resources into well-defined subdirectories, and bundle structures vary depending on the platform and the type of the bundle. By using a bundle object, you do not have to know the structure of a bundle to access its resources. The bundle object provides a single interface for locating items, taking into account the bundle structure, user preferences, available localizations, and other relevant factors.


An NSBundleResourceRequest object manages the availability of on-demand resources. On-demand resources are app contents hosted on the App Store that you download only when you need them.


The ByteCountFormatter class converts a byte count value into a localized description that is formatted with the appropriate byte modifier (KB, MB, GB and so on).


An NSCache object is a mutable collection that stores key-value pairs, similar to an NSDictionary object. The NSCache class provides a programmatic interface to adding and removing objects and setting eviction policies based on the total cost and number of objects in the cache.


An NSCachedURLResponse object represents a cached response to a URL request. It provides the server’s response metadata in the form of an NSURLResponse object, along with an NSData object containing the actual cached content data. Its storage policy determines whether the response should be cached on disk, in memory, or not at all.


NSCalendar objects encapsulate information about systems of reckoning time in which the beginning, length, and divisions of a year are defined. They provide information about the calendar and support for calendrical computations such as determining the range of a given calendrical unit and adding units to a given absolute time.


An NSCharacterSet object represents a set of Unicode-compliant characters. NSString and NSScanner objects use NSCharacterSet objects to group characters together for searching operations, so that they can find any of a particular set of characters during a search. The cluster’s two public classes, NSCharacterSet and NSMutableCharacterSet, declare the programmatic interface for static and dynamic character sets, respectively.


NSClassDescription is an abstract class that provides the interface for querying the relationships and properties of a class. Concrete subclasses of NSClassDescription provide the available attributes of objects of a particular class and the relationships between that class and other classes. Defining these relationships between classes allows for more intelligent and flexible manipulation of objects with key-value coding.


An instance of NSCloneCommand clones the specified scriptable object or objects (such as words, paragraphs, images, and so on) and inserts them in the specified location, or the default location if no location is specified. The cloned scriptable objects typically correspond to objects in the application, but aren’t required to. This command corresponds to AppleScript’s duplicate command.


An instance of NSCloseCommand closes the specified scriptable object or objects—typically a document or window (and its associated document, if any). The command may optionally specify a location to save in and how to handle modified documents (by automatically saving changes, not saving them, or asking the user).


The NSCoder abstract class declares the interface used by concrete subclasses to transfer objects and other values between memory and some other format. This capability provides the basis for archiving (where objects and data items are stored on disk) and distribution (where objects and data items are copied between different processes or threads). The concrete subclasses provided by Foundation for these purposes are NSArchiver, NSUnarchiver, NSKeyedArchiver, NSKeyedUnarchiver, and NSPortCoder. Concrete subclasses of NSCoder are referred to in general as coder classes, and instances of these classes as coder objects (or simply coders). A coder object that can only encode values is referred to as an encoder object, and one that can only decode values as a decoder object.


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 NSCondition class implements a condition variable whose semantics follow those used for POSIX-style conditions. A condition object acts as both a lock and a checkpoint in a given thread. The lock protects your code while it tests the condition and performs the task triggered by the condition. The checkpoint behavior requires that the condition be true before the thread proceeds with its task. While the condition is not true, the thread blocks. It remains blocked until another thread signals the condition object.


The NSConditionLock class defines objects whose locks can be associated with specific, user-defined conditions. Using an NSConditionLock object, you can ensure that a thread can acquire a lock only if a certain condition is met. Once it has acquired the lock and executed the critical section of code, the thread can relinquish the lock and set the associated condition to something new. The conditions themselves are arbitrary: you define them as needed for your application.


An instance of NSCountCommand counts the number of objects of a specified class in the specified object container (such as the number of words in a paragraph or document) and returns the result.


The NSCountedSet class declares the programmatic interface to a mutable, unordered collection of distinct objects. A counted set is also known as a bag.


An instance of NSCreateCommand creates the specified scriptable object (such as a document), optionally supplying the new object with the specified attributes. This command corresponds to AppleScript’s make command.


NSData and its mutable subclass NSMutableData provide data objects, object-oriented wrappers for byte buffers. Data objects let simple allocated buffers (that is, data with no embedded pointers) take on the behavior of Foundation objects.


The NSDataDetector class is a specialized subclass of NSRegularExpression designed to match natural language text for predefined data patterns.


NSDate objects encapsulate a single point in time, independent of any particular calendrical system or time zone. Date objects are immutable, representing an invariant time interval relative to an absolute reference date (00:00:00 UTC on 1 January 2001).


NSDateComponents encapsulates the components of a date in an extendable, object-oriented manner. It is used to specify a date by providing the temporal components that make up a date and time: hour, minutes, seconds, day, month, year, and so on. It can also be used to specify a duration of time, for example, 5 hours and 16 minutes. An NSDateComponents object is not required to define all the component fields. When a new instance of NSDateComponents is created the date components are set to NSDateComponentUndefined.


An NSDateComponentsFormatter object takes quantities of time and formats them as a user-readable string. Use a date components formatter to create strings for your app’s interface. The formatter object has many options for creating both abbreviated and expanded strings. The formatter takes the current user’s locale and language into account when generating strings.


Instances of NSDateFormatter create string representations of NSDate objects, and convert textual representations of dates and times into NSDate objects. For user-visible representations of dates and times, NSDateFormatter provides a variety of localized presets and configuration options. For fixed format representations of dates and times, you can specify a custom format string.


An NSDateInterval object represents a closed interval between two dates. The NSDateInterval class provides a programmatic interface for calculating the duration of a time interval and determining whether a date falls within it, as well as comparing date intervals and checking to see whether they intersect.


An NSDateIntervalFormatter object creates user-readable strings from pairs of dates. Use a date interval formatter to create user-readable strings of the form <start> - <end> for your app’s interface, where <start> and <end> are date values that you supply. The formatter uses locale and language information, along with custom formatting options, to define the content of the resulting string. You can specify different styles for the date and time information in each date value.


NSDecimalNumber, an immutable subclass of NSNumber, provides an object-oriented wrapper for doing base-10 arithmetic. An instance can represent any number that can be expressed as mantissa x 10^exponent where mantissa is a decimal integer up to 38 digits long, and exponent is an integer from –128 through 127.


NSDecimalNumberHandler is a class that adopts the NSDecimalNumberBehaviors protocol. This class allows you to set the way an NSDecimalNumber object rounds off and handles errors, without having to create a custom class.


An instance of NSDeleteCommand deletes the specified scriptable object or objects (such as words, paragraphs, and so on).


The NSDictionary class declares the programmatic interface to objects that manage immutable associations of keys and values. Use this class or its subclass NSMutableDictionary when you need a convenient and efficient way to retrieve data associated with an arbitrary key. NSDictionary creates static dictionaries, and NSMutableDictionary creates dynamic dictionaries. (For convenience, the term dictionary refers to any instance of one of these classes without specifying its exact class membership.)


NSDimension is an abstract subclass of Unit that declares a programmatic interface for objects that represent a dimensional unit of measure. The Foundation framework provides concrete subclasses for many of the most common types of physical units.


An NSDirectoryEnumerator object enumerates the contents of a directory, returning the pathnames of all files and directories contained within that directory. These pathnames are relative to the directory.


The NSDistributedLock class defines an object that multiple applications on multiple hosts can use to restrict access to some shared resource, such as a file.


The NSDistributedNotificationCenter class provides a way to send notifications to objects in other tasks. It takes NSNotification objects and broadcasts them to any objects in other tasks that have registered for the notification with their task’s default distributed notification center.


The NSEnergyFormatter class provides properly formatted, localized descriptions of energy values. Use this class to create localized strings when displaying energy information (for example, joules or calories) to users.


NSEnumerator is an abstract class, instances of whose subclasses enumerate collections of other objects, such as arrays and dictionaries.


An NSError object encapsulates information about an error condition in an extendable, object-oriented manner. It consists of a predefined error domain, a domain-specific error code, and a user info dictionary containing application-specific information.


NSException is used to implement exception handling and contains information about an exception. An exception is a special condition that interrupts the normal flow of program execution. Each application can interrupt the program for different reasons. For example, one application might interpret saving a file in a directory that is write-protected as an exception. In this sense, the exception is equivalent to an error. Another application might interpret the user’s key-press (for example, Control-C) as an exception: an indication that a long-running process should be aborted.


An instance of NSExistsCommand determines whether a specified scriptable object, such as a word, paragraph, or image, exists.


NSExpression is used to represent expressions in a predicate.


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 NSFastEnumerationIterator class wraps an object conforming to the NSFastEnumeration protocol in order to provide conformance to the Swift Standard Library IteratorProtocol protocol.


The NSFileAccessIntent class stores the details of coordinated-read and coordinated-write operations. Use this class when performing asynchronous operations with a file coordinator using the coordinator’s coordinate(with:queue:byAccessor:) method.


The NSFileCoordinator class coordinates the reading and writing of files and directories among multiple processes and objects in the same process. You use instances of this class as is to read from, write to, modify the attributes of, change the location of, or delete a file or directory, but before your code to perform those actions executes, the file coordinator lets registered file presenter objects perform any tasks that they might require to ensure their own integrity. For example, if you want to change the location of a file, other objects interested in that file need to know where you intend to move it so that they can update their references.


The FileHandle class is an object-oriented wrapper for a file descriptor. You use file handle objects to access data associated with files, sockets, pipes, and devices. For files, you can read, write, and seek within the file. For sockets, pipes, and devices, you can use a file handle object to monitor the device and process data asynchronously.


An FileManager object lets you examine the contents of the file system and make changes to it. The FileManager class provides convenient access to a shared file manager object that is suitable for most types of file-related manipulations. A file manager object is typically your primary mode of interaction with the file system. You use it to locate, create, copy, and move files and directories. You also use it to get information about a file or directory or change some of its attributes.


The NSFileSecurity class is an Objective-C stub class that is transparently bridged to CFFileSecurity. It is used to encapsulate security information about a file. This class contains no methods. To access the contents of this object, use the accessor functions described in CFFileSecurity.


An NSFileVersion object represents a snapshot of a file at a specific point in time. Use the methods of this class to access, create, and manage file revisions in your app.


The NSFileWrapper class provides access to the attributes and contents of file-system nodes. A file-system node is a file, directory, or symbolic link. Instances of this class are known as file wrappers.


NSFormatter is an abstract class that declares an interface for objects that create, interpret, and validate the textual representation of values. The Foundation framework provides several concrete subclasses of NSFormatter, including ByteCountFormatter, DateFormatter, DateComponentsFormatter, DateIntervalFormatter, EnergyFormatter, LengthFormatter, MassFormatter, NumberFormatter, and PersonNameComponentsFormatter.


An instance of NSGetCommand gets the specified value or object from the specified scriptable object: for example, the words from a paragraph or the name of a document.


An NSHTTPCookie object represents an HTTP cookie. It is an immutable object, initialized from a dictionary containing the cookie attributes.


NSHTTPCookieStorage implements a singleton object (shared instance) that manages storage of cookies. Each cookie is represented by an instance of the HTTPCookie class. As a rule, cookies are shared among all applications and are kept in sync across process boundaries. Session cookies (where the cookie object’s isSessionOnly method returns true) are local to a single process and are not shared.


The NSHTTPURLResponse class is a subclass of URLResponse that provides methods for accessing information specific to HTTP protocol responses. Whenever you make HTTP URL load requests, any response objects you get back from the URLSession, NSURLConnection, or NSURLDownload class are instances of the NSHTTPURLResponse class.


NSHashTable is modeled after NSSet but provides different options, in particular to support weak relationships.


The NSHost class provides methods to access the network name and address information for a host. Instances of the NSHost class represent individual hosts on a network. Use NSHost objects to get the current host’s names and addresses and to look up other hosts by name or by address.


The NSISO8601DateFormatter class generates and parses string representations of dates following the ISO 8601 standard. Use this class to create ISO 8601 representations of dates and create dates from text strings in ISO 8601 format.


The NSIndexPath class represents the path to a specific node in a tree of nested array collections. This path is known as an index path.


The NSIndexSet class represents an immutable collection of unique unsigned integers, known as indexes because of the way they are used. This collection is referred to as an index set. Indexes must be in the range 0 .. NSNotFound - 1.


The NSIndexSpecifier class represents an object in a collection (or container) with an index number. The script terms first and front specify the object with index 0, while last specifies the object with index of count-1. A negative index indicates a location by counting backward from the last object in the collection.


NSInputStream is a subclass of NSStream that provides read-only stream functionality.


An NSItemProvider object provides a lazy and secure way to convey data between a host app and extension. An item provider object wraps data such as text, images, or URLs and stores type information to help processes identify that data. When you actually want the data in an item provider, you load it asynchronously, which gives the item provider time to transfer it from another process as needed.


You use the NSJSONSerialization class to convert JSON to Foundation objects and convert Foundation objects to JSON.


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. When you archive a set of objects, the class information and instance variables for each object are written to the archive. NSKeyedArchiver’s companion class, NSKeyedUnarchiver, decodes the data in an archive and creates a set of objects equivalent to the original set.


NSKeyedUnarchiver, a concrete subclass of NSCoder, defines methods for decoding a set of named objects (and scalar values) from a keyed archive. Such archives are produced by instances of the NSKeyedArchiver class.


The NSLengthFormatter class provides properly formatted, localized descriptions of linear distances (for example, length and height measurements). Use this class to create localized length strings when displaying distance information to users.


The NSLinguisticTagger class is used to automatically segment natural-language text and tag it with information, such as parts of speech. It can also tag languages, scripts, stem forms of words, etc. An instance of this class is assigned a string to tag, and clients can then obtain tags and ranges for tokens in that string appropriate to a given tag scheme.


NSLocale objects encapsulate information about linguistic, cultural, and technological conventions and standards. Examples of information encapsulated by a locale include the symbol used for the decimal separator in numbers and the way dates are formatted.


An NSLock object is used to coordinate the operation of multiple threads of execution within the same application. An NSLock object can be used to mediate access to an application’s global data or to protect a critical section of code, allowing it to run atomically.


Instances of this class perform logical operations of AND, OR, and NOT on Boolean expressions represented by NSSpecifierTest objects. These operators are equivalent to “&&”, “||”, and “!” in the C language.


NSMachPort is a subclass of Port that can be used as an endpoint for distributed object connections (or raw messaging). NSMachPort is an object wrapper for a Mach port, the fundamental communication port in macOS. NSMachPort allows for local (on the same machine) communication only. A companion class, SocketPort, allows for both local and remote distributed object communication, but may be more expensive than NSMachPort for the local case.


The NSMapTable class is a mutable collection modeled after NSDictionary, with the following differences:


The NSMassFormatter class provides properly formatted, localized descriptions of mass and weight values. Use this class to create localized mass strings when displaying mass information to the users.


An NSMeasurement object represents a quantity and unit of measure. The NSMeasurement class provides a programmatic interface to converting measurements into different units, as well as calculating the sum or difference between two measurements.


The NSMeasurementFormatter class provides properly formatted, localized representations of units and measurements. Use this class to create localized representations of measurements when displaying quantities of units to the user.


NSMessagePort is a subclass of NSPort that can be used as an endpoint for distributed object connections (or raw messaging). NSMessagePort allows for local (on the same machine) communication only. A companion class, NSSocketPort, allows for both local and remote communication, but may be more expensive than NSMessagePort for the local case.


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.


Specifies the middle object in a collection or, if not a one-to-many relationship, the sole object. You don’t normally subclass NSMiddleSpecifier.


An instance of NSMoveCommand moves the specified scriptable object or objects; for example, it may move words to a new location in a document or a file to a new directory.


The NSMutableArray class declares the programmatic interface to objects that manage a modifiable array of objects. This class adds insertion and deletion operations to the basic array-handling behavior inherited from NSArray.


The NSMutableAttributedString class declares additional methods for mutating the content of an attributed string. You can add and remove characters (raw strings) and attributes separately or together as attributed strings. See the class description for NSAttributedString for more information about attributed strings.


The NSMutableCharacterSet class declares the programmatic interface to objects that manage a modifiable set of Unicode characters. You can add or remove characters from a mutable character set as numeric values in NSRange structures or as character values in strings, combine character sets by union or intersection, and invert a character set.


NSMutableData and its superclass NSData provide data objects, or object-oriented wrappers for byte buffers. Data objects let simple allocated buffers (that is, data with no embedded pointers) take on the behavior of Foundation objects. They are typically used for data storage and are also useful in Distributed Objects applications, where data contained in data objects can be copied or moved between applications. NSData creates static data objects, and NSMutableData creates dynamic data objects. You can easily convert one type of data object to the other with the initializer that takes an NSData object or an NSMutableData object as an argument.


The NSMutableDictionary class declares the programmatic interface to objects that manage mutable associations of keys and values. It adds modification operations to the basic operations it inherits from NSDictionary.


The NSMutableIndexSet class represents a mutable collection of unique unsigned integers, known as indexes because of the way they are used. This collection is referred to as a mutable index set. The set of valid indexes are 0 .. NSNotFound - 1; trying to use indexes outside this range is an error.


NSMutableOrderedSet class declares the programmatic interface to a mutable, ordered collection of distinct objects.


The NSMutableSet class declares the programmatic interface to a mutable, unordered collection of distinct objects.


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. To construct and manage an immutable string—or a string that cannot be changed after it has been created—use an object of the NSString class.


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 NSNetService class represents a network service, either one your application publishes or is a client of. This class and the NSNetServiceBrowser class use multicast DNS to convey information about network services to and from your application. The API of NSNetService provides a convenient way to publish the services offered by your application and to resolve the socket address for a service.


The NSNetServiceBrowser class defines an interface for finding published services on a network using multicast DNS. An instance of NSNetServiceBrowser is known as a network service browser.


NSNotification objects encapsulate information so that it can be broadcast to other objects by an NSNotificationCenter object. An NSNotification object (referred to as a notification) contains a name, an object, and an optional dictionary. The name is a tag identifying the notification. The object is any object that the poster of the notification wants to send to observers of that notification (typically, it is the object that posted the notification). The dictionary stores other related objects, if any. NSNotification objects are immutable objects.


An NSNotificationCenter object (or simply, notification center) provides a mechanism for broadcasting information within a program. An NSNotificationCenter object is essentially a notification dispatch table.


NSNotificationQueue objects (or simply notification queues) act as buffers for notification centers (instances of NSNotificationCenter). Whereas a notification center distributes notifications when posted, notifications placed into the queue can be delayed until the end of the current pass through the run loop or until the run loop is idle. Duplicate notifications can also be coalesced so that only one notification is sent although multiple notifications are posted. A notification queue maintains notifications (instances of NSNotification) generally in a first in first out (FIFO) order. When a notification rises to the front of the queue, the queue posts it to the notification center, which in turn dispatches the notification to all objects registered as observers.


The NSNull class defines a singleton object used to represent null values in collection objects (which don’t allow nil values).


NSNumber is a subclass of NSValue that offers a value as any C scalar (numeric) type. It defines a set of methods specifically for setting and accessing the value as a signed or unsigned char, short int, int, long int, long long int, float, or double or as a BOOL. (Note that number objects do not necessarily preserve the type they are created with.) It also defines a compare(_:) method to determine the ordering of two NSNumber objects.


Instances of NSNumberFormatter format the textual representation of cells that contain NSNumber objects and convert textual representations of numeric values into NSNumber objects. The representation encompasses integers, floats, and doubles; floats and doubles can be formatted to a specified decimal position. NSNumberFormatter objects can also impose ranges on the numeric values cells can accept.


The NSOperation class is an abstract class you use to encapsulate the code and data associated with a single task. Because it is abstract, you do not use this class directly but instead subclass or use one of the system-defined subclasses (NSInvocationOperation or BlockOperation) to perform the actual task. Despite being abstract, the base implementation of NSOperation does include significant logic to coordinate the safe execution of your task. The presence of this built-in logic allows you to focus on the actual implementation of your task, rather than on the glue code needed to ensure it works correctly with other system objects.


The NSOperationQueue class regulates the execution of a set of Operation objects. After being added to a queue, an operation remains in that queue until it is explicitly canceled or finishes executing its task. Operations within the queue (but not yet executing) are themselves organized according to priority levels and inter-operation object dependencies and are executed accordingly. An application may create multiple operation queues and submit operations to any of them.


NSOrderedSet and its subclass, NSMutableOrderedSet, declare the programmatic interfaces to an ordered collection of objects.


The NSOrthography class describes the linguistic content of a piece of text, typically used for the purposes of spelling and grammar checking.


The NSOutputStream class is a subclass of NSStream that provides write-only stream functionality.


An NSPersonNameComponents object encapsulates the components of a person's name in an extendable, object-oriented manner. It is used to specify a person's name by providing the components comprising a full name: given name, middle name, family name, prefix, suffix, nickname, and phonetic representation.


The NSPersonNameComponentsFormatter class provides localized representations of the components of a person’s name, as represented by a NSPersonNameComponents object. Use this class to create localized names when displaying person name information to the user.


NSPipe objects provide an object-oriented interface for accessing pipes. An NSPipe object represents both ends of a pipe and enables communication through the pipe. A pipe is a one-way communications channel between related processes; one process writes data, while the other process reads that data. The data that passes through the pipe is buffered; the size of the buffer is determined by the underlying operating system. NSPipe is an abstract class, the public interface of a class cluster.


The NSPointerArray class represents a mutable collection modeled after NSArray, but can also hold nil values. nil values may be inserted or removed and contribute to the object’s count. An NSPointerArray object can also increase and decrease its count directly.


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. Communication occurs between NSPort objects, which typically reside in different threads or tasks. The distributed objects system uses NSPort objects to send PortMessage objects back and forth. You should implement interapplication communication using distributed objects whenever possible and use NSPort objects only when necessary.


An NSPortMessage defines a low-level, operating system-independent type for inter-application (and inter-thread) messages. Port messages are used primarily by the distributed objects system. You should implement inter-application communication using distributed objects whenever possible and use NSPortMessage only when necessary.


Instances of NSPositionalSpecifier specify an insertion point in a container relative to another object in the container, for example, before first word or after paragraph 4. The container is specified by an instance of NSScriptObjectSpecifier. NSPositionalSpecifier objects commonly encapsulate object specifiers used as arguments to the make (create) and move commands and indicate where the created or moved object is to be inserted relative to the object represented by an object specifier.


The NSPredicate class is used to define logical conditions used to constrain a search either for a fetch or for in-memory filtering.


The NSProcessInfo class provides methods that you use to access information about the current process. Each process has a single, shared NSProcessInfo object, known as a process information agent.


The Progress class provides a self-contained mechanism for progress reporting. It makes it easy for code that does work to report the progress of that work, and for user interface code to observe that progress for presentation to the user. Specifically, it can be used to show the user a progress bar and explanatory text, both updated properly as progress is made. It also allows work to be cancelled or paused by the user.


The NSPropertyListSerialization class provides methods that convert Property list to and from several serialized formats. Property list objects include NSData, NSString, NSArray, NSDictionary, NSDate, and NSNumber objects.


Specifies a simple attribute value, a one-to-one relationship, or all elements of a to-many relationship. You don’t normally subclass NSPropertySpecifier.


The NSProtocolChecker class defines an object that restricts the messages that can be sent to another object (referred to as the checker’s delegate). This fact can be particularly useful when an object with many methods, only a few of which ought to be remotely accessible, is made available using the distributed objects system.


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. Typically, a message to a proxy is forwarded to the real object or causes the proxy to load (or transform itself into) the real object. Subclasses of NSProxy can be used to implement transparent distributed messaging (for example, NSDistantObject) or for lazy instantiation of objects that are expensive to create.


You should use the NSPurgeableData class when you have objects with bytes that can be discarded when no longer needed. Purging these bytes may be advantageous for your system, because doing so frees up memory needed by other applications. The NSPurgeableData class provides a default implementation of the NSDiscardableContent protocol, from which it inherits its interface.


An instance of NSQuitCommand quits the specified application. The command may optionally specify how to handle modified documents (automatically save changes, don’t save them, or ask the user). For details, see the description for the quit command in "Apple Events Sent By the Mac OS" in How Cocoa Applications Handle Apple Events inCocoa Scripting Guide.


Specifies an arbitrary object in a collection or, if not a one-to-many relationship, the sole object.


An NSRangeSpecifier object specifies a range (that is, an uninterrupted series) of objects in a container through two delimiting objects. The range is represented by two object specifiers, a start specifier and an end specifier, which can be of any specifier type (such as NSIndexSpecifier or NSWhoseSpecifier object). These specifiers are evaluated in the context of the same container object as the range specifier itself.


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. While the locking thread has one or more locks, all other threads are prevented from accessing the code protected by the lock.


The NSRegularExpression class is used to represent and apply regular expressions to Unicode strings. An instance of this class is an immutable representation of a compiled regular expression pattern and various option flags. The pattern syntax currently supported is that specified by ICU. The ICU regular expressions are described at


Specifies an object in a collection by its position relative to another object. You don’t normally subclass NSRelativeSpecifier.


The RunLoop class declares the programmatic interface to objects that manage input sources. An RunLoop object processes input for sources such as mouse and keyboard events from the window system, Port objects, and NSConnection objects. An RunLoop object also processes Timer events.


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.


An instance of NSScriptClassDescription describes a script class that a Cocoa application supports.


Provides a mechanism for converting one kind of scripting data to another. A shared instance of this class coerces (converts) object values to objects of another class, using information supplied by classes that register with it. Coercions frequently are required during key-value coding.


An instance of NSScriptCommand represents a scripting statement, such as set word 5 of the front document to word 1 of the second document, and contains the information needed to perform the operation specified by the statement.


An instance of NSScriptCommandDescription describes a script command that a Cocoa application supports.


An NSScriptExecutionContext object is a shared instance (there is only one instance of the class) that represents the context in which the current script command is executed. NSScriptExecutionContext tracks global state relating to the command being executed, especially the top-level container object (that is, the container implied by a specifier object that specifies no container) used in an evaluation of an NSScriptObjectSpecifier object.


NSScriptObjectSpecifier is the abstract superclass for classes that instantiate objects called “object specifiers.” An object specifier represents an AppleScript reference form, which is a natural-language expression such as words 10 through 20 or front document or words whose color is red.


NSScriptSuiteRegistry functions as the top-level repository of scriptability information for an application at runtime.


NSScriptWhoseTest is an abstract class whose sole method is isTrue(). Two concrete subclasses of NSScriptWhoseTest generate objects representing Boolean expressions comparing one object with another and objects representing multiple Boolean expressions connected by logical operators (OR, AND, NOT). These classes are, respectively, NSSpecifierTest and NSLogicalTest. In evaluating itself, an NSWhoseSpecifier invokes the isTrue() method of its “test” object.


The NSSet, NSMutableSet, and NSCountedSet classes declare the programmatic interface to an unordered collection of objects.


An instance of NSSetCommand sets one or more attributes or relationships to one or more values; for example, it may set the (x, y) coordinates for a window’s position or set the name of a document.


NSSocketPort is a subclass of NSPort that represents a BSD socket. An NSSocketPort object can be used as an endpoint for distributed object connections. Companion classes, NSMachPort and NSMessagePort, allow for local (on the same machine) communication only. The NSSocketPort class allows for both local and remote communication, but may be more expensive than the others for the local case.


An NSSortDescriptor object 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. Instances of NSSortDescriptor are immutable.


Instances of this class represent a Boolean expression; they evaluate an object specifier and compare the resulting object to another object using a given comparison method. For more information on NSSpecifierTest, see the method description for its sole public method, its initializer, init(objectSpecifier:comparisonOperator:test:).


The NSSpellServer class gives you a way to make your application’s spell checker available as a spelling service available to any application.


NSStream is an abstract class for objects representing streams. Its interface is common to all Cocoa stream classes, including its concrete subclasses InputStream and OutputStream.


The NSString class and its mutable subclass, NSMutableString, provide an extensive set of APIs for working with strings, including methods for comparing, searching, and modifying strings. NSString objects are used throughout Foundation and other Cocoa frameworks, serving as the basis for all textual and linguistic functionality on the platform.


Using the NSTask class, your program can run another program as a subprocess and can monitor that program’s execution. An NSTask object creates a separate executable entity; it differs from NSThread in that it does not share memory space with the process that creates it.


NSTextCheckingResult is a class used to describe items located by text checking. Each of these objects represents an occurrence of requested textual content that has been found during the analysis of a block of text.


An Thread object controls a thread of execution. Use this class when you want to have an Objective-C method run in its own thread of execution. Threads are especially useful when you need to perform a lengthy task, but don’t want it to block the execution of the rest of the application. In particular, you can use threads to avoid blocking the main thread of the application, which handles user interface and event-related actions. Threads can also be used to divide a large job into several smaller jobs, which can lead to performance increases on multi-core computers.


NSTimeZone is an abstract class that defines the behavior of time zone objects. Time zone objects represent geopolitical regions. Consequently, these objects have names for these regions. Time zone objects also represent a temporal offset, either plus or minus, from Greenwich Mean Time (GMT) and an abbreviation (such as PST for Pacific Standard Time).


You use the NSTimer class to create timer objects or, more simply, timers. A timer waits until a certain time interval has elapsed and then fires, sending a specified message to a target object. For example, you could create an NSTimer object that sends a message to a window, telling it to update itself after a certain time interval.


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 URLCache class implements the caching of responses to URL load requests by mapping NSURLRequest objects to NSCachedURLResponse objects. It provides a composite in-memory and on-disk cache, and lets you manipulate the sizes of both the in-memory and on-disk portions. You can also control the path where cache data is stored persistently.


The NSURLComponents class is a class that is designed to parse URLs based on RFC 3986 and to construct URLs from their constituent parts. Its behavior differs subtly from the NSURL class, which conforms to older RFCs. However, you can easily obtain an NSURL object based on the contents of a URL components object or vice versa.


An NSURLConnection object lets you load the contents of a URL by providing a URL request object. The interface for NSURLConnection is sparse, providing only the controls to start and cancel asynchronous loads of a URL request. You perform most of your configuration on the URL request object itself.


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.


The NSURLDownload class downloads a request asynchronously and saves the data to a file. The interface for NSURLDownload provides methods to initialize a download, set the destination path and cancel loading the request.


NSURLHandle declares the programmatic interface for an object that accesses and manages resource data indicated by an NSURL object. A single NSURLHandle can service multiple equivalent NSURL objects, but only if these URLs map to the same resource.


An NSURLProtectionSpace object represents a server or an area on a server, commonly referred to as a realm, that requires authentication. The protection space defines a series of matching constraints that determine which credential should be provided.


An NSURLProtocol object handles the loading of protocol-specific URL data. The NSURLProtocol class itself is an abstract class that provides the infrastructure for processing URLs with a specific URL scheme. You create subclasses for any custom protocols or URL schemes that your app supports.


An NSURLQueryItem object represents a single name/value pair for an item in the query portion of a URL. You use query items with the queryItems property of an NSURLComponents object.


NSURLRequest objects represent a URL load request in a manner independent of protocol and URL scheme.


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 NSURLSession class and related classes provide an API for downloading content. This API provides a rich set of delegate methods for supporting authentication and gives your app the ability to perform background downloads when your app is not running or, in iOS, while your app is suspended.


An NSURLSessionConfiguration object defines the behavior and policies to use when uploading and downloading data using an URLSession object. When uploading or downloading data, creating a configuration object is always the first step you must take. You use this object to configure the timeout values, caching policies, connection requirements, and other types of information that you intend to use with your URLSession object.


An NSURLSessionDataTask is a concrete subclass of URLSessionTask. The methods in the NSURLSessionDataTask class are documented in URLSessionTask.


An NSURLSessionDownloadTask is a concrete subclass of URLSessionTask. Most of the methods associated with this class are documented in URLSessionTask.


NSURLSessionStreamTask is a concrete subclass of URLSessionTask. Many of the methods in the NSURLSessionStreamTask class are documented in URLSessionTask.


The URLSessionTask class is the base class for tasks in a URL session. Tasks are always part of a session; you create a task by calling one of the task creation methods on an URLSession object. The method you call determines the type of task.


An NSURLSessionTaskMetrics object encapsulates the metrics for a session task. Each object contains the taskInterval and redirectCount, as well as metrics for each request / response transaction made during the execution of the task.


An NSURLSessionTaskTransactionMetrics object encapsulates the performance metrics collected during the execution of a session task. Each object consists of a request and response property, corresponding to the request and response of the corresponding task. It also contains temporal metrics, starting with fetchStartDate and ending with responseEndDate, as well as other characteristics likenetworkProtocolName and resourceFetchType.


The NSURLSessionUploadTask class is a subclass of URLSessionDataTask, which in turn is a concrete subclass of URLSessionTask. The methods associated with the NSURLSessionUploadTask class are documented in URLSessionTask.


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. You can store scalar values such as BOOL, as well as values containing any of the property list object types: NSNumber, NSString, NSDate, NSData, NSArray, and NSDictionary.


NSUnarchiver, a concrete subclass of NSCoder, defines methods for decoding a set of Objective-C objects from an archive. Such archives are produced by objects of the NSArchiver class.


NSUndoManager is a general-purpose recorder of operations for undo and redo.


Specifies an object in a collection (or container) by unique ID. This specifier works only for objects that have an ID property. The unique ID object passed to an instance of NSUniqueIDSpecifier must be either an NSNumber object or an NSString object. The exact type should match the scripting dictionary declaration of the ID attribute for the relevant scripting class.


NSUnit is an abstract class that declares a programmatic interface for objects that represent a unit of measure.


The NSUnitAcceleration class is an Dimension subclass that encapsulates units of measure for acceleration.


The NSUnitAngle class is an Dimension subclass that encapsulates units of measure for rotation.


The NSUnitArea class is an Dimension subclass that encapsulates units of measure for area.


The NSUnitConcentrationMass class is an Dimension subclass that encapsulates units of measure for concentration of mass.


The NSUnitDispersion class is an Dimension subclass that encapsulates units of measure for an amount-of-substance fraction.


The NSUnitDuration class is an Dimension subclass that encapsulates units of measure for duration of time.


The NSUnitElectricCharge class is an Dimension subclass that encapsulates units of measure for electric charge.


The NSUnitElectricCurrent class is an Dimension subclass that encapsulates units of measure for electric current.


The NSUnitElectricPotentialDifference class is an Dimension subclass that encapsulates units of measure for electric potential difference.


The NSUnitElectricResistance class is an Dimension subclass that encapsulates units of measure for electric resistance.


The NSUnitEnergy class is an Dimension subclass that encapsulates units of measure for energy.


The NSUnitFrequency class is an Dimension subclass that encapsulates units of measure for frequency.


The NSUnitFuelEfficiency class is an Dimension subclass that encapsulates units of measure for fuel efficiency.


The NSUnitLength class is an Dimension subclass that encapsulates units of measure for length.


The NSUnitMass class is an Dimension subclass that encapsulates units of measure for mass.


The NSUnitPower class is an Dimension subclass that encapsulates units of measure for power.


The NSUnitPressure class is an Dimension subclass that encapsulates units of measure for pressure.


The NSUnitSpeed class is an Dimension subclass that encapsulates units of measure for speed.


The NSUnitTemperature class is an Dimension subclass that encapsulates units of measure for temperature.


The NSUnitVolume class is an Dimension subclass that encapsulates units of measure for volume.


An NSUserActivity object provides a lightweight way to capture the state of your app and put it to use later. You create user activity objects and use them to capture information about what the user was doing, such as viewing app content, editing a document, viewing a web page, or watching a video. When the system launches your app and an activity object is available, your app can use the information in that object to restore itself to an appropriate state. Spotlight also uses your user activity objects to improve search results for the user.


The NSUserAppleScriptTask class is intended to run AppleScript scripts from your application. It is intended to execute user-supplied scripts and will execute them outside of the application's sandbox, if any.


The NSUserAutomatorTask class is intended to run Automator workflows from your application. It is intended to execute user-supplied workflows, and will execute them outside of the application's sandbox, if any.


The NSUserDefaults class provides a programmatic interface for interacting with the defaults system. The defaults system allows an application to customize its behavior to match a user’s preferences. For example, you can allow users to determine what units of measurement your application displays or how often documents are automatically saved. Applications record such preferences by assigning values to a set of parameters in a user’s defaults database. The parameters are referred to as defaults since they’re commonly used to determine an application’s default state at startup or the way it acts by default.


The NSUserNotification class is used to configure a notification that is scheduled for display by the NSUserNotificationCenter class.


The NSUserNotificationCenter class delivers user notifications to the user from applications or helper applications.


The NSUserScriptTask class is an abstract class that is able to run all the scripts normally run by the one of its subclasses, however it ignores the results.. It is intended to execute user-supplied scripts and will execute them outside of the application's sandbox, if any.


The NSUserUnixTask class is intended to run unix applications, typically a shell script, from your application. It is intended to execute user-supplied scripts, and will execute them outside of the application's sandbox, if any.


An NSValue object is a simple container for a single C or Objective-C data item. It can hold any of the scalar types such as int, float, and char, as well as pointers, structures, and object id references. Use this class to work with such data types in collections (such as NSArray and NSSet), Key-value coding, and other APIs that require Objective-C objects. NSValue objects are always immutable.


NSValueTransformer is an abstract class that is used by the Cocoa Bindings technology to transform values from one representation to another.


NSWhoseSpecifier specifies every object in a collection (or every element in a container) that matches the condition defined by a single Boolean expression or multiple Boolean expressions connected by logical operators. NSWhoseSpecifier is unique among object specifiers in that its top-level container is typically not the application object but an evaluated object specifier involved in the tested-for condition. An NSWhoseSpecifier object encapsulates a “test” object for defining this condition. A test object is instantiated from a subclass of the abstract NSScriptWhoseTest class, whose one declared method is isTrue(). See "Boolean Expressions and Logical Operations" in NSScriptObjectSpecifier and the descriptions in NSComparisonMethods and NSScriptingComparisonMethods for more information.


An instance of the NSXMLDTD class represents a Document Type Definition. It is held as a property of an XMLDocument instance, accessed through the NSXMLDocument method dtd (and set via setDTD:).


Instances of the NSXMLDTDNode class represent element, attribute-list, entity, and notation declarations in a Document Type Definition. NSXMLDTDNode objects are the sole children of a NSXMLDTD object (possibly along with comment nodes and processing-instruction nodes). They themselves cannot have any children.


An instance of NSXMLDocument represents an XML document as internalized into a logical tree structure. An NSXMLDocument object can have multiple child nodes but only one element, the root element. Any other node must be a XMLNode object representing a comment or a processing instruction. If you attempt to add any other kind of child node to an NSXMLDocument object, such as an attribute, namespace, another document object, or an element other than the root, NSXMLDocument raises an exception. If you add a valid child node and that object already has a parent, NSXMLDocument raises an exception. An NSXMLDocument object may also have document-global attributes, such as XML version, character encoding, referenced DTD, and MIME type.


Instances of the NSXMLElement class represent element nodes in an XML tree structure. An NSXMLElement object may have child nodes, specifically comment nodes, processing-instruction nodes, text nodes, and other NSXMLElement nodes. It may also have attribute nodes and namespace nodes associated with it (however, namespace and attribute nodes are not considered children). Any attempt to add a XMLDocument node, XMLDTD node, namespace node, or attribute node as a child raises an exception. If you add a child node to an NSXMLElement object and that child already has a parent, NSXMLElement raises an exception; the child must be detached or copied first.


Objects of the NSXMLNode class are nodes in the abstract, logical tree structure that represents an XML document. Node objects can be of different kinds, corresponding to the following markup constructs in an XML document: element, attribute, text, processing instruction, namespace, and comment. In addition, a document-node object (specifically, an instance of XMLDocument) represents an XML document in its entirety. NSXMLNode objects can also represent document type declarations as well as declarations in Document Type Definitions (DTDs). Class factory methods of NSXMLNode enable you to create nodes of each kind. Only document, element, and DTD nodes may have child nodes.


Instances of this class parse XML documents (including DTD declarations) in an event-driven manner. An NSXMLParser notifies its delegate about the items (elements, attributes, CDATA blocks, comments, and so on) that it encounters as it processes an XML document. It does not itself do anything with those parsed items except report them. It also reports parsing errors. For convenience, an NSXMLParser object in the following descriptions is sometimes referred to as a parser object. Unless used in a callback, the NSXMLParser is a thread-safe class as long as any given instance is only used in one thread.


The NSXPCConnection class provides a bi-directional communication channel between two processes.


Class that describes the methods that may be sent to an exported object or remote object proxy.


The NSXPCListener class and its delegate are responsible for waiting for new incoming connections, configuring them, and accepting or rejecting them.


Class that "names" a specific NSXPCListener object.


NSUnitConverter is an abstract class that describes how to convert a unit to and from the base unit of its dimension.


NSUnitConverterLinear is an UnitConverter subclass for converting between units using a linear equation.


The NSUnitIlluminance class is an Dimension subclass that encapsulates units of measure for illuminance.



Describes an error type that specifically provides a domain, code, and user-info dictionary.


The FileManagerDelegate protocol defines optional methods for managing operations involving the copying, moving, linking, or removal of files and directories. When you use an FileManager object to initiate a copy, move, link, or remove operation, the file manager asks its delegate whether the operation should begin at all and whether it should proceed when an error occurs.


Describes an error that provides localized messages describing why an error occurred and provides more information about the error.


The NSNetServiceBrowserDelegate protocol defines the optional methods implemented by delegates of NetServiceBrowser objects.


The NSNetServiceDelegate protocol defines the optional methods implemented by delegates of NetService objects.


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. This capability provides the basis for archiving (where objects and other structures are stored on disk) and distribution (where objects are copied to different address spaces).


This informal protocol defines a set of default comparison methods useful for the comparisons in NSSpecifierTest.


The NSCopying protocol declares a method for providing functional copies of an object. The exact meaning of “copy” can vary from class to class, but a copy must be a functionally independent object with values identical to the original at the time the copy was made. A copy produced with NSCopying is implicitly retained by the sender, who is responsible for releasing it.


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. These methods are invoked when an NSError object is returned that specifies the implementing object as the error recoveryAttempter and the user has selected one of the error’s localized recovery options.


The NSExtensionRequestHandling protocol provides a life cycle hook into an app extension. An extension’s principal object can implement this protocol and use beginRequest(with:) to keep track of the request from a host app.


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 NSFilePresenter protocol should be implemented by objects that allow the user to view or edit the content of files or directories. You use file presenters in conjunction with an NSFileCoordinator object to coordinate access to a file or directory among the objects of your application and between your application and other processes. When changes to an item occur, the system notifies objects that adopt this protocol and gives them a chance to respond appropriately.


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 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. Thus, all of an object’s properties can be accessed in a consistent manner.


The NSKeyValueObserving (KVO) informal protocol defines a mechanism that allows objects to be notified of changes to the specified properties of other objects.


The NSLocking protocol declares the elementary methods adopted by classes that define lock objects. A lock object is used to coordinate the actions of multiple threads of execution within a single application. By using a lock object, an application can protect critical sections of code from being executed simultaneously by separate threads, thus protecting shared data and other shared resources from corruption.


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. Only classes that define an “immutable vs. mutable” distinction should adopt this protocol. Classes that don’t define such a distinction should adopt NSCopying instead.


The NSObject protocol groups methods that are fundamental to all Objective-C objects.


The NSPortDelegate protocol defines the optional methods implemented by delegates of Port objects.


Implement the ProgressReporting protocol to report progress for classes that return only one progress object.


This informal protocol defines a set of methods useful for comparing script objects.


Cocoa scripting takes advantage of key-value coding to get and set information in scriptable objects. The methods in this category provide additional capabilities for working with key-value coding, including getting and setting key values by index in multivalue keys and coercing (or converting) a key value. Additional methods allow the implementer of a scriptable container class to provide fast access to elements that are being referenced by name and unique ID.


Informal protocol. Allows scriptable objects that can provide a fully specified object specifier to themselves within an application to do so. It also enables containers of objects to perform their own specifier evaluation.


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 NSSpellServerDelegate protocol defines the optional methods implemented by delegates of NSSpellServer objects.


The NSStreamDelegate protocol defines the optional methods implemented by delegates of Stream 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. Many methods in this protocol existed as part of an informal protocol in previous versions of macOS and iOS.


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 download(with:) method. The methods in this protocol provide progress information about the download of a URL asset and, when downloading concludes, provide a file URL where the downloaded file can be accessed.


The NSURLDownloadDelegate protocol defines methods that allow an object to receive informational callbacks about the asynchronous load of a download’s URL request. Other delegate methods provide facilities that allow the delegate to customize the process of performing an asynchronous URL load.


This protocol defines the interface for clients to NSURLHandle.


The NSURLProtocolClient protocol provides the interface used by NSURLProtocol subclasses to communicate with the URL loading system. An application should never have the need to implement this protocol.


The NSURLSessionDataDelegate protocol defines the methods that a delegate of an URLSession object can implement to handle task-level events specific to data tasks and upload tasks. Your session delegate should also implement the methods in the URLSessionTaskDelegate protocol to handle task-level events that are common to all task types, and methods in the URLSessionDelegate protocol to handle session-level events.


The NSURLSessionDelegate protocol describes the methods that URLSession objects call on their delegates to handle session-level events. In addition to the methods defined in this protocol, most delegates should also implement some or all of the methods in the URLSessionTaskDelegate, URLSessionDataDelegate, and URLSessionDownloadDelegate protocols to handle task-level events.


The NSURLSessionDownloadDelegate protocol defines delegate methods that you should implement when using URLSession download tasks. In addition to these methods, be sure to implement the methods in the URLSessionTaskDelegate and URLSessionDelegate protocols to handle events common to all task types and session-level events, respectively.


The NSURLSessionStreamDelegate protocol defines delegate methods that you should implement when using URLSession stream tasks. In addition to these methods, be sure to implement the methods in the URLSessionTaskDelegate and URLSessionDelegate protocols to handle events common to all task types and session-level events, respectively.


The NSURLSessionTaskDelegate protocol defines the task-specific delegate methods that you should implement when working with any type of URLSession 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. For example, a user browsing an article in Safari on a Mac can move to an iOS device where the same webpage automatically opens in Safari with the same scroll position.


The NSUserNotificationCenterDelegate protocol allows customization of the behavior of the default NSUserNotificationCenter instance.


The NSXMLParserDelegate protocol defines the optional methods implemented by delegates of XMLParser objects.


Protocol for delegates to the NSXPC listener class that allows you to accept or reject new connections to the listener.


Describes the methods for creating new proxy objects.


Describes an error that may be recoverable by presenting several potential recovery options to the user.


Decorates types which are backed by a Foundation reference type.


Foundation Functions

This document describes the functions and function-like macros defined in the Foundation Framework.

Foundation Constants
Foundation Data Types

This document describes the data types and constants found in the Foundation framework.

Foundation StructuresFoundation Enumerations

Extended Types


A value type whose instances are either true or false.


The basic type for floating-point scalar values in Core Graphics and related frameworks.


Coordinates that establish the edges of a rectangle.


A double-precision, floating-point value type.


A type representing an error value that can be thrown.


A single-precision, floating-point value type.


A signed integer value type.


A 16-bit signed integer value type.


A 32-bit signed integer value type.


A 64-bit signed integer value type.


An 8-bit signed integer value type.


NSObject is the root class of most Objective-C class hierarchies. Through NSObject, objects inherit a basic interface to the runtime system and the ability to behave as Objective-C objects.


A Unicode string value.


A position in a string’s collection of UTF-16 code units.


An unsigned integer value type.


A 16-bit unsigned integer value type.


A 32-bit unsigned integer value type.


A 64-bit unsigned integer value type.


An 8-bit unsigned integer value type.