Framework

Foundation

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.

Overview

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 NSMutable​String, 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:

Symbols

Classes

NSAffine​Transform

The NSAffine​Transform class provides methods for creating, concatenating, and applying affine transformations.

NSApple​Event​Descriptor

An instance of NSApple​Event​Descriptor 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 NSApple​Event​Descriptor, but should rarely need to work directly with the AEDesc data structure.

NSApple​Event​Manager

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

NSApple​Script

The NSApple​Script class provides the ability to load, compile, and execute scripts.

NSArchiver

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

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

NSAssertion​Handler

NSAssertion​Handler 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 NSAssertion​Handler object describing the failure. Each thread has its own NSAssertion​Handler object. When invoked, an assertion handler prints an error message that includes the method and class (or function) containing the assertion and raises an NSInternal​Inconsistency​Exception.

NSAttributed​String

An NSAttributed​String 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, NSAttributed​String and NSMutable​Attributed​String, declare the programmatic interface for read-only attributed strings and modifiable attributed strings, respectively.

NSBackground​Activity​Scheduler

An NSBackground​Activity​Scheduler 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, NSBackground​Activity​Scheduler gives the system flexibility to determine the most efficient time to execute based on energy usage, thermal conditions, and CPU use.

Block​Operation

The NSBlock​Operation 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.

Bundle

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.

NSBundle​Resource​Request

An NSBundle​Resource​Request 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.

Byte​Count​Formatter

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

NSCache

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.

Cached​URLResponse

An NSCached​URLResponse 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

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.

NSCharacter​Set

An NSCharacter​Set object represents a set of Unicode-compliant characters. NSString and NSScanner objects use NSCharacter​Set 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, NSCharacter​Set and NSMutable​Character​Set, declare the programmatic interface for static and dynamic character sets, respectively.

NSClass​Description

NSClass​Description is an abstract class that provides the interface for querying the relationships and properties of a class. Concrete subclasses of NSClass​Description 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.

NSClone​Command

An instance of NSClone​Command 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.

NSClose​Command

An instance of NSClose​Command 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).

NSCoder

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, NSKeyed​Archiver, NSKeyed​Unarchiver, and NSPort​Coder. 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.

NSComparison​Predicate

NSComparison​Predicate is a subclass of NSPredicate that you use to compare expressions.

NSCompound​Predicate

NSCompound​Predicate is a subclass of NSPredicate used to represent logical “gate” operations (AND/OR/NOT) and comparison operations.

NSCondition

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.

NSCondition​Lock

The NSCondition​Lock class defines objects whose locks can be associated with specific, user-defined conditions. Using an NSCondition​Lock 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.

NSCount​Command

An instance of NSCount​Command 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.

NSCounted​Set

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

NSCreate​Command

An instance of NSCreate​Command 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

NSData and its mutable subclass NSMutable​Data 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.

NSData​Detector

The NSData​Detector class is a specialized subclass of NSRegular​Expression designed to match natural language text for predefined data patterns.

NSDate

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).

NSDate​Components

NSDate​Components 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 NSDate​Components object is not required to define all the component fields. When a new instance of NSDate​Components is created the date components are set to NSDate​Component​Undefined.

Date​Components​Formatter

An NSDate​Components​Formatter 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.

Date​Formatter

Instances of NSDate​Formatter 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, NSDate​Formatter provides a variety of localized presets and configuration options. For fixed format representations of dates and times, you can specify a custom format string.

NSDate​Interval

An NSDate​Interval object represents a closed interval between two dates. The NSDate​Interval 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.

Date​Interval​Formatter

An NSDate​Interval​Formatter 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.

NSDecimal​Number

NSDecimal​Number, 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.

NSDecimal​Number​Handler

NSDecimal​Number​Handler is a class that adopts the NSDecimal​Number​Behaviors protocol. This class allows you to set the way an NSDecimal​Number object rounds off and handles errors, without having to create a custom class.

NSDelete​Command

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

NSDictionary

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

NSDictionary.Iterator
Dimension

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.

File​Manager.Directory​Enumerator

An NSDirectory​Enumerator 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.

NSDistributed​Lock

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

Distributed​Notification​Center

The NSDistributed​Notification​Center 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.

Energy​Formatter

The NSEnergy​Formatter 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

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

NSError

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

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.

NSExists​Command

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

NSExpression

NSExpression is used to represent expressions in a predicate.

NSExtension​Context

Represents the host app context from which an app extension is invoked.

NSExtension​Item

An NSExtension​Item object is an immutable collection of values representing different aspects of an item for the extension to act upon.

NSFast​Enumeration​Iterator
NSFile​Access​Intent

The NSFile​Access​Intent 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:​by​Accessor:​) method.

NSFile​Coordinator

The NSFile​Coordinator 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.

File​Handle

The File​Handle 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.

File​Manager

An File​Manager object lets you examine the contents of the file system and make changes to it. The File​Manager 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.

NSFile​Security

The NSFile​Security class is an Objective-C stub class that is transparently bridged to CFFile​Security. 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.

NSFile​Version

An NSFile​Version 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.

File​Wrapper

The NSFile​Wrapper 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.

Formatter

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 Byte​Count​Formatter, Date​Formatter, Date​Components​Formatter, Date​Interval​Formatter, Energy​Formatter, Length​Formatter, Mass​Formatter, Number​Formatter, and Person​Name​Components​Formatter.

NSGet​Command

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

HTTPCookie

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

HTTPCookie​Storage

NSHTTPCookie​Storage 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 is​Session​Only method returns true) are local to a single process and are not shared.

HTTPURLResponse

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.

NSHash​Table

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

Host

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.

ISO8601Date​Formatter

The NSISO8601Date​Formatter 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.

NSIndex​Path

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

NSIndex​Set

The NSIndex​Set 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 .. NSNot​Found - 1.

NSIndex​Specifier

The NSIndex​Specifier 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.

Input​Stream

NSInput​Stream is a subclass of NSStream that provides read-only stream functionality.

NSItem​Provider

An NSItem​Provider 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.

JSONSerialization

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

NSKeyed​Archiver

NSKeyed​Archiver, 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. NSKeyed​Archiver’s companion class, NSKeyed​Unarchiver, decodes the data in an archive and creates a set of objects equivalent to the original set.

NSKeyed​Unarchiver

NSKeyed​Unarchiver, 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 NSKeyed​Archiver class.

Length​Formatter

The NSLength​Formatter 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.

NSLinguistic​Tagger

The NSLinguistic​Tagger 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

An object that encapsulates information about linguistic, cultural, and technological conventions and standards, such as date formats, decimal separators, and currency symbols.

NSLock

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.

NSLogical​Test

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

NSMach​Port

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

NSMap​Table

The NSMap​Table class is a mutable collection modeled after NSDictionary, with the following differences:

Mass​Formatter

The NSMass​Formatter 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.

NSMeasurement

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.

Measurement​Formatter

The NSMeasurement​Formatter 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.

Message​Port

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

NSMetadata​Item

The NSMetadata​Item class represents the metadata associated with a file, providing a simple interface to retrieve the available attribute names and values.

NSMetadata​Query

The NSMetadata​Query class encapsulates the functionality provided by the MDQuery opaque type for querying the Spotlight metadata.

NSMetadata​Query​Attribute​Value​Tuple

The NSMetadata​Query​Attribute​Value​Tuple class represents attribute-value tuples, which are objects that contain the attribute name and value of a metadata attribute.

NSMetadata​Query​Result​Group

The NSMetadata​Query​Result​Group class represents a collection of grouped attribute results returned by an NSMetadata​Query object.

NSMiddle​Specifier

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

NSMove​Command

An instance of NSMove​Command 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.

NSMutable​Array

The NSMutable​Array 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.

NSMutable​Attributed​String

The NSMutable​Attributed​String 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 NSAttributed​String for more information about attributed strings.

NSMutable​Character​Set

The NSMutable​Character​Set 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.

NSMutable​Data

NSMutable​Data 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 NSMutable​Data 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 NSMutable​Data object as an argument.

NSMutable​Dictionary

The NSMutable​Dictionary 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.

NSMutable​Index​Set

The NSMutable​Index​Set 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 inclusive range of valid indexes is 0...(NSNot​Found - 1); trying to use indexes outside this range is invalid.

NSMutable​Ordered​Set

NSMutable​Ordered​Set class declares the programmatic interface to a mutable, ordered collection of distinct objects.

NSMutable​Set

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

NSMutable​String

The NSMutable​String 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.

NSMutable​URLRequest

NSMutable​URLRequest 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.

NSName​Specifier
Net​Service

The NSNet​Service class represents a network service, either one your application publishes or is a client of. This class and the NSNet​Service​Browser class use multicast DNS to convey information about network services to and from your application. The API of NSNet​Service provides a convenient way to publish the services offered by your application and to resolve the socket address for a service.

Net​Service​Browser

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

NSNotification

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.

Notification​Center

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

Notification​Queue

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.

NSNull

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

NSNumber

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.

Number​Formatter

Instances of NSNumber​Formatter 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. NSNumber​Formatter objects can also impose ranges on the numeric values cells can accept.

Operation

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 (NSInvocation​Operation or Block​Operation) 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.

Operation​Queue

The Operation​Queue 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.

NSOrdered​Set

NSOrdered​Set and its subclass, NSMutable​Ordered​Set, declare the programmatic interfaces to an ordered collection of objects.

NSOrthography

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

Output​Stream

The NSOutput​Stream class is a subclass of NSStream that provides write-only stream functionality.

NSPerson​Name​Components

An NSPerson​Name​Components 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.

Person​Name​Components​Formatter

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

Pipe

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.

NSPointer​Array

The NSPointer​Array 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 NSPointer​Array object can also increase and decrease its count directly.

NSPointer​Functions

An instance of NSPointer​Functions defines callout functions appropriate for managing a pointer reference held somewhere else.

Port

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 Port​Message objects back and forth. You should implement interapplication communication using distributed objects whenever possible and use NSPort objects only when necessary.

Port​Message

An NSPort​Message 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 NSPort​Message only when necessary.

NSPositional​Specifier

Instances of NSPositional​Specifier 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 NSScript​Object​Specifier. NSPositional​Specifier 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.

NSPredicate

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

Process​Info

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

Progress

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.

Property​List​Serialization

The NSProperty​List​Serialization 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.

NSProperty​Specifier

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

NSProtocol​Checker

The NSProtocol​Checker 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

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, NSDistant​Object) or for lazy instantiation of objects that are expensive to create.

NSPurgeable​Data

You should use the NSPurgeable​Data 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 NSPurgeable​Data class provides a default implementation of the NSDiscardable​Content protocol, from which it inherits its interface.

NSQuit​Command

An instance of NSQuit​Command 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.

NSRandom​Specifier

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

NSRange​Specifier

An NSRange​Specifier 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 NSIndex​Specifier or NSWhose​Specifier object). These specifiers are evaluated in the context of the same container object as the range specifier itself.

NSRecursive​Lock

NSRecursive​Lock 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.

NSRegular​Expression

The NSRegular​Expression 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 http://userguide.icu-project.org/strings/regexp.

NSRelative​Specifier

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

Run​Loop

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

Scanner

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.

NSScript​Class​Description

An instance of NSScript​Class​Description describes a script class that a Cocoa application supports.

NSScript​Coercion​Handler

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.

NSScript​Command

An instance of NSScript​Command 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.

NSScript​Command​Description

An instance of NSScript​Command​Description describes a script command that a Cocoa application supports.

NSScript​Execution​Context

An NSScript​Execution​Context 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. NSScript​Execution​Context 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 NSScript​Object​Specifier object.

NSScript​Object​Specifier

NSScript​Object​Specifier 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.

NSScript​Suite​Registry

NSScript​Suite​Registry functions as the top-level repository of scriptability information for an application at runtime.

NSScript​Whose​Test

NSScript​Whose​Test is an abstract class whose sole method is is​True(). Two concrete subclasses of NSScript​Whose​Test 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, NSSpecifier​Test and NSLogical​Test. In evaluating itself, an NSWhose​Specifier invokes the is​True() method of its “test” object.

NSSet

The NSSet, NSMutable​Set, and NSCounted​Set classes declare the programmatic interface to an unordered collection of objects.

NSSet​Command

An instance of NSSet​Command 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.

Socket​Port

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

NSSort​Descriptor

An NSSort​Descriptor 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 NSSort​Descriptor are immutable.

NSSpecifier​Test

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 NSSpecifier​Test, see the method description for its sole public method, its initializer, init(object​Specifier:​comparison​Operator:​test:​).

NSSpell​Server

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

Stream

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

NSString

The NSString class and its mutable subclass, NSMutable​String, 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.

Process

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.

NSText​Checking​Result

NSText​Checking​Result 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.

Thread

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.

NSTime​Zone

NSTime​Zone 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).

Timer

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.

NSURL

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.

URLAuthentication​Challenge

NSURLAuthenticationChallenge encapsulates a challenge from a server requiring authentication from the client.

URLCache

The URLCache class implements the caching of responses to URL load requests by mapping NSURLRequest objects to NSCached​URLResponse 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.

NSURLComponents

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.

NSURLConnection

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.

URLCredential

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.

URLCredential​Storage

NSURLCredentialStorage implements a singleton (shared object) that manages the credential storage.

NSURLDownload

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

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.

URLProtection​Space

An NSURLProtection​Space 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.

URLProtocol

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.

NSURLQuery​Item

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

NSURLRequest

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

URLResponse

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.

URLSession

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.

URLSession​Configuration

An NSURLSession​Configuration 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.

URLSession​Data​Task

An NSURLSession​Data​Task is a concrete subclass of URLSession​Task. The methods in the NSURLSession​Data​Task class are documented in URLSession​Task.

URLSession​Download​Task

An NSURLSession​Download​Task is a concrete subclass of URLSession​Task. Most of the methods associated with this class are documented in URLSession​Task.

URLSession​Stream​Task

NSURLSession​Stream​Task is a concrete subclass of URLSession​Task. Many of the methods in the NSURLSession​Stream​Task class are documented in URLSession​Task.

URLSession​Task

The URLSession​Task 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.

URLSession​Task​Metrics

An NSURLSession​Task​Metrics object encapsulates the metrics for a session task. Each object contains the task​Interval and redirect​Count, as well as metrics for each request / response transaction made during the execution of the task.

URLSession​Task​Transaction​Metrics

An NSURLSession​Task​Transaction​Metrics 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 fetch​Start​Date and ending with response​End​Date, as well as other characteristics like network​Protocol​Name and resource​Fetch​Type.

URLSession​Upload​Task

The NSURLSession​Upload​Task class is a subclass of URLSession​Data​Task, which in turn is a concrete subclass of URLSession​Task. The methods associated with the NSURLSession​Upload​Task class are documented in URLSession​Task.

NSUUID

The NSUUID class creates UUID strings that are to uniquely identify types, interfaces, and other items.

NSUbiquitous​Key​Value​Store

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

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.

Undo​Manager

NSUndo​Manager is a general-purpose recorder of operations for undo and redo.

NSUnique​IDSpecifier

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 NSUnique​IDSpecifier 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.

Unit

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

Unit​Acceleration

The NSUnit​Acceleration class is an Dimension subclass that encapsulates units of measure for acceleration.

Unit​Angle

The NSUnit​Angle class is an Dimension subclass that encapsulates units of measure for rotation.

Unit​Area

The NSUnit​Area class is an Dimension subclass that encapsulates units of measure for area.

Unit​Concentration​Mass

The NSUnit​Concentration​Mass class is an Dimension subclass that encapsulates units of measure for concentration of mass.

Unit​Dispersion

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

Unit​Duration

The NSUnit​Duration class is an Dimension subclass that encapsulates units of measure for duration of time.

Unit​Electric​Charge

The NSUnit​Electric​Charge class is an Dimension subclass that encapsulates units of measure for electric charge.

Unit​Electric​Current

The NSUnit​Electric​Current class is an Dimension subclass that encapsulates units of measure for electric current.

Unit​Electric​Potential​Difference

The NSUnit​Electric​Potential​Difference class is an Dimension subclass that encapsulates units of measure for electric potential difference.

Unit​Electric​Resistance

The NSUnit​Electric​Resistance class is an Dimension subclass that encapsulates units of measure for electric resistance.

Unit​Energy

The NSUnit​Energy class is an Dimension subclass that encapsulates units of measure for energy.

Unit​Frequency

The NSUnit​Frequency class is an Dimension subclass that encapsulates units of measure for frequency.

Unit​Fuel​Efficiency

The NSUnit​Fuel​Efficiency class is an Dimension subclass that encapsulates units of measure for fuel efficiency.

Unit​Length

The NSUnit​Length class is an Dimension subclass that encapsulates units of measure for length.

Unit​Mass

The NSUnit​Mass class is an Dimension subclass that encapsulates units of measure for mass.

Unit​Power

The NSUnit​Power class is an Dimension subclass that encapsulates units of measure for power.

Unit​Pressure

The NSUnit​Pressure class is an Dimension subclass that encapsulates units of measure for pressure.

Unit​Speed

The NSUnit​Speed class is an Dimension subclass that encapsulates units of measure for speed.

Unit​Temperature

The NSUnit​Temperature class is an Dimension subclass that encapsulates units of measure for temperature.

Unit​Volume

The NSUnit​Volume class is an Dimension subclass that encapsulates units of measure for volume.

NSUser​Activity

An NSUser​Activity 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.

NSUser​Apple​Script​Task

The NSUser​Apple​Script​Task 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.

NSUser​Automator​Task

The NSUser​Automator​Task 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.

User​Defaults

The NSUser​Defaults 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.

NSUser​Notification

The NSUser​Notification class is used to configure a notification that is scheduled for display by the NSUser​Notification​Center class.

NSUser​Notification​Action
NSUser​Notification​Center

The NSUser​Notification​Center class delivers user notifications to the user from applications or helper applications.

NSUser​Script​Task

The NSUser​Script​Task 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.

NSUser​Unix​Task

The NSUser​Unix​Task 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.

NSValue

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.

Value​Transformer

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

NSWhose​Specifier

NSWhose​Specifier 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. NSWhose​Specifier 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 NSWhose​Specifier object encapsulates a “test” object for defining this condition. A test object is instantiated from a subclass of the abstract NSScript​Whose​Test class, whose one declared method is is​True(). See "Boolean Expressions and Logical Operations" in NSScript​Object​Specifier and the descriptions in NSComparisonMethods and NSScriptingComparisonMethods for more information.

XMLDTD

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 set​DTD:​).

XMLDTDNode

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.

XMLDocument

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.

XMLElement

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.

XMLNode

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.

XMLParser

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.

NSXPCConnection

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

NSXPCInterface

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

NSXPCListener

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

NSXPCListener​Endpoint

Class that "names" a specific NSXPCListener object.

Unit​Converter

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

Unit​Converter​Linear

NSUnit​Converter​Linear is an Unit​Converter subclass for converting between units using a linear equation.

Unit​Illuminance

The NSUnit​Illuminance class is an Dimension subclass that encapsulates units of measure for illuminance.

Protocols

Custom​NSError

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

File​Manager​Delegate

The File​Manager​Delegate protocol defines optional methods for managing operations involving the copying, moving, linking, or removal of files and directories. When you use an File​Manager 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.

Localized​Error

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

Net​Service​Browser​Delegate

The NSNet​Service​Browser​Delegate protocol defines the optional methods implemented by delegates of Net​Service​Browser objects.

Net​Service​Delegate

The NSNet​Service​Delegate protocol defines the optional methods implemented by delegates of Net​Service objects.

NSCache​Delegate

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.

NSCoding

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).

NSComparison​Methods

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

NSCopying

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.

NSDecimal​Number​Behaviors

The NSDecimal​Behaviors protocol declares three methods that control the discretionary aspects of working with NSDecimal​Number objects.

NSDiscardable​Content

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.

NSError​Recovery​Attempting

The NSError​Recovery​Attempting 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 recovery​Attempter and the user has selected one of the error’s localized recovery options.

NSExtension​Request​Handling

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

NSFast​Enumeration

The fast enumeration protocol NSFast​Enumeration must be adopted and implemented by objects used in conjunction with the for language construct used in conjunction with Cocoa objects.

NSFile​Presenter

The NSFile​Presenter 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 NSFile​Coordinator 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.

NSKeyed​Archiver​Delegate

The NSKeyed​Archiver​Delegate protocol defines the optional methods implemented by delegates of NSKeyed​Archiver objects.

NSKeyed​Unarchiver​Delegate

The NSKeyed​Unarchiver​Delegate protocol defines the optional methods implemented by delegates of NSKeyed​Unarchiver objects.

NSKey​Value​Coding

The NSKey​Value​Coding 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.

NSKey​Value​Observing

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

NSLocking

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.

NSMach​Port​Delegate

The NSMach​Port​Delegate protocol defines the optional methods implemented by delegates of NSMach​Port objects.

NSMetadata​Query​Delegate

The NSMetadata​Query​Delegate protocol defines the optional methods implemented by delegates of NSMetadata​Query objects.

NSMutable​Copying

The NSMutable​Copying 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.

NSObject​Protocol

The group of methods that are fundamental to all Objective-C objects.

Port​Delegate

The NSPort​Delegate protocol defines the optional methods implemented by delegates of Port objects.

Progress​Reporting

Implement the Progress​Reporting protocol to report progress for classes that return only one progress object.

NSScripting​Comparison​Methods

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

NSScript​Key​Value​Coding

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.

NSScript​Object​Specifiers

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.

NSSecure​Coding

A protocol that indicates that an object handles encoding and decoding instances of itself in a manner that is robust against object substitution attacks.

NSSpell​Server​Delegate

The NSSpell​Server​Delegate protocol defines the optional methods implemented by delegates of NSSpell​Server objects.

Stream​Delegate

The NSStream​Delegate protocol defines the optional methods implemented by delegates of Stream objects.

URLAuthentication​Challenge​Sender

The NSURLAuthentication​Challenge​Sender protocol represents the interface that the sender of an authentication challenge must implement.

NSURLConnection​Data​Delegate

The NSURLConnection​Data​Delegate 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.

NSURLConnection​Delegate

The NSURLConnection​Delegate protocol defines methods common to the NSURLConnection​Data​Delegate and NSURLConnection​Download​Delegate protocols.

NSURLConnection​Download​Delegate

The NSURLConnection​Download​Delegate 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.

NSURLDownload​Delegate

The NSURLDownload​Delegate 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.

NSURLHandle​Client

This protocol defines the interface for clients to NSURLHandle.

URLProtocol​Client

The NSURLProtocol​Client 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.

URLSession​Data​Delegate

The NSURLSession​Data​Delegate 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 URLSession​Task​Delegate protocol to handle task-level events that are common to all task types, and methods in the URLSession​Delegate protocol to handle session-level events.

URLSession​Delegate

The NSURLSession​Delegate 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 URLSession​Task​Delegate, URLSession​Data​Delegate, and URLSession​Download​Delegate protocols to handle task-level events.

URLSession​Download​Delegate

The NSURLSession​Download​Delegate 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 URLSession​Task​Delegate and URLSession​Delegate protocols to handle events common to all task types and session-level events, respectively.

URLSession​Stream​Delegate

The NSURLSession​Stream​Delegate 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 URLSession​Task​Delegate and URLSession​Delegate protocols to handle events common to all task types and session-level events, respectively.

URLSession​Task​Delegate

The NSURLSession​Task​Delegate protocol defines the task-specific delegate methods that you should implement when working with any type of URLSession task.

NSUser​Activity​Delegate

An object conforming to the NSUser​Activity​Delegate protocol works with an NSUser​Activity 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.

NSUser​Notification​Center​Delegate

The NSUser​Notification​Center​Delegate protocol allows customization of the behavior of the default NSUser​Notification​Center instance.

XMLParser​Delegate

The NSXMLParser​Delegate protocol defines the optional methods implemented by delegates of XMLParser objects.

NSXPCListener​Delegate

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

NSXPCProxy​Creating

Describes the methods for creating new proxy objects.

Recoverable​Error

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

Reference​Convertible

Decorates types which are backed by a Foundation reference type.

Reference

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

Bool

A value type whose instances are either true or false.

CGFloat

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

CGRect​Edge

Coordinates that establish the edges of a rectangle.

Double

A double-precision, floating-point value type.

Error

A type representing an error value that can be thrown.

Float

A single-precision, floating-point value type.

Int

A signed integer value type.

Int16

A 16-bit signed integer value type.

Int32

A 32-bit signed integer value type.

Int64

A 64-bit signed integer value type.

Int8

An 8-bit signed integer value type.

NSObject

The root class of most Objective-C class hierarchies, from which subclasses inherit a basic interface to the runtime system and the ability to behave as Objective-C objects.

String

A Unicode string value.

String.UTF16View.Index

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

UInt

An unsigned integer value type.

UInt16

A 16-bit unsigned integer value type.

UInt32

A 32-bit unsigned integer value type.

UInt64

A 64-bit unsigned integer value type.

UInt8

An 8-bit unsigned integer value type.