Construct and manage your app’s user interface for macOS. Respond to user interactions and system events, enable accessibility, and work with documents, text, and images.


AppKit is a framework containing all the objects you need to implement your graphical, event-driven user interface: windows, panels, buttons, menus, scrollers, and text fields. AppKit handles all the details for you as it efficiently draws on the screen, communicates with hardware devices and screen buffers, clears areas of the screen before drawing, and clips views. The number of classes in AppKit may seem daunting at first. However, most AppKit classes are support classes that you use indirectly. You also have the choice at which level you use AppKit:

  • Use Interface Builder to create connections from user interface objects to your application objects. In this case, all you need to do is implement your application classes—implement those action and delegate methods. For example, implement the method that is invoked when the user selects a menu item.

  • Control the user interface programmatically, which requires more familiarity with AppKit classes and protocols. For example, allowing the user to drag an icon from one window to another requires some programming and familiarity with the NSDragging... protocols.

  • Implement your own objects by subclassing NSView or other classes. When subclassing NSView you write your own drawing methods using graphics functions. Subclassing requires a deeper understanding of how AppKit works.

To learn more about AppKit, review the NSApplication, NSWindow, and NSView class specifications, paying close attention to delegate methods. For a deeper understanding of how AppKit works, see the specifications for NSResponder and RunLoop (NSRunLoop is in the Foundation framework).

AppKit Classes and Protocols

AppKit is large; it comprises more than 125 classes and protocols. The classes all descend from the Foundation framework’s NSObject class. The following sections briefly describe some of the topics that AppKit addresses through its classes and protocols.

Encapsulating an Application

Every application uses a single instance of NSApplication to control the main event loop, keep track of the application’s windows and menus, distribute events to the appropriate objects (that is, itself or one of its windows), set up autorelease pools, and receive notification of application-level events. An NSApplication object has a delegate (an object that you assign) that is notified when the application starts or terminates, is hidden or activated, should open a file selected by the user, and so forth. By setting the NSApplication object’s delegate and implementing the delegate methods, you customize the behavior of your application without having to subclass NSApplication.

General Event Handling and Drawing

The NSResponder class defines the responder chain, an ordered list of objects that respond to user events. When the user clicks the mouse button or presses a key, an event is generated and passed up the responder chain in search of an object that can “respond” to it. Any object that handles events must inherit from the NSResponder class. The core AppKit classes, NSApplication, NSWindow, and NSView, inherit from NSResponder.

An NSApplication object maintains a list of NSWindow objects—one for each window belonging to the application—and each NSWindow object maintains a hierarchy of NSView objects. The view hierarchy is used for drawing and handling events within a window. An NSWindow object handles window-level events, distributes other events to its views, and provides a drawing area for its views. An NSWindow object also has a delegate allowing you to customize its behavior.

NSView is an abstract class for all objects displayed in a window. All subclasses implement a drawing method using graphics functions; draw(_:) is the primary method you override when creating a new NSView subclass.


The NSPanel class is a subclass of NSWindow that you use to display transient, global, or pressing information. For example, you would use an instance of NSPanel, rather than an instance of NSWindow, to display error messages or to query the user for a response to remarkable or unusual circumstances. AppKit implements some common panels for you such as the Save, Open and Print panels, used to save, open, and print documents. Using these panels gives the user a consistent “look and feel” across applications for common operations.

Menus and Cursors

The NSMenu, NSMenuItem, and NSCursor classes define the look and behavior of the menus and cursors that your application displays to the user.

Grouping and Scrolling Views

The NSBox, NSScrollView, and NSSplitView classes provide graphic “accessories” to other view objects or collections of views in windows. With the NSBox class, you can group elements in windows and draw a border around the entire group. The NSSplitView class lets you “stack” views vertically or horizontally, apportioning to each view some amount of a common territory; a sliding control bar lets the user redistribute the territory among views. The NSScrollView class and its helper class, NSClipView, provide a scrolling mechanism as well as the graphic objects that let the user initiate and control a scroll. The NSRulerView class allows you to add a ruler and markers to a scroll view.

Controlling an Application

The NSControl and NSCell classes, and their subclasses, define a common set of user interface objects such as buttons, sliders, and browsers that the user can manipulate graphically to control some aspect of your application. Just what a particular control affects is up to you: When a control is “touched,” it sends an action message to a target object. You typically use Interface Builder to set these targets and actions by Control-dragging from the control object to your application or other object. You can also set targets and actions programmatically.

An NSControl object is associated with one or more NSCell objects that implement the details of drawing and handling events. For example, a button comprises both an NSButton object and an NSButtonCell object. The reason for this separation of functionality is primarily to allow NSCell classes to be reused by NSControl classes. For example, NSMatrix and NSTableView can contain multiple NSCell objects of different types.


The NSTableView class displays data in row and column form. NSTableView is ideal for, but not limited to, displaying database records, where rows correspond to each record and columns contain record attributes. The user can edit individual cells and rearrange the columns. You control the behavior and content of an NSTableView object by setting its delegate and data source objects.

Text and Fonts

The NSTextField class implements a simple editable text field, and the NSTextView class provides more comprehensive editing features for larger text bodies.

NSTextView, a subclass of the abstract NSText class, defines the interface to Cocoa’s extended text system. NSTextView supports rich text, attachments (graphics, file, and other), input management and key binding, and marked text attributes. NSTextView works with the font panel and menu, rulers and paragraph styles, the Services facility (for example, the spell-checking service), and the pasteboard. NSTextView also allows customizing through delegation and notifications—you rarely need to subclass NSTextView. You rarely create instances of NSTextView programmatically either, since objects on Interface Builder’s palettes, such as NSTextField, NSForm, and NSScrollView, already contain NSTextView objects.

It is also possible to do more powerful and more creative text manipulation (such as displaying text in a circle) using NSTextStorage, NSLayoutManager, NSTextContainer, and related classes.

The NSFont and NSFontManager classes encapsulate and manage font families, sizes, and variations. The NSFont class defines a single object for each distinct font; for efficiency, these objects, which can be rather large, are shared by all the objects in your application. The NSFontPanel class defines the font specification panel that’s presented to the user.

Graphics and Color

The classes NSImage and NSImageRep encapsulate graphics data, allowing you to easily and efficiently access images stored in files on the disk and displayed on the screen. NSImageRep subclasses each know how to draw an image from a particular kind of source data. The presentation of an image is greatly influenced by the hardware that it’s displayed on. For example, a particular image may look good on a color monitor, but may be too “rich” for monochrome. Through the image classes, you can group representations of the same image, where each representation fits a specific type of display device—the decision of which representation to use can be left to the NSImage class itself.

Color is supported by the classes NSColor, NSColorPanel, NSColorList, NSColorPicker, and NSColorWell. NSColor supports a rich set of color formats and representations, including custom ones. The other classes are mostly interface classes: They define and present panels and views that allow the user to select and apply colors. For example, the user can drag colors from the color panel to any color well. The NSColorPicking protocol lets you extend the standard color panel.


With very little programming on your part, custom view objects can be dragged and dropped anywhere. Objects become part of this dragging mechanism by conforming to NSDragging... protocols: draggable objects conform to the NSDraggingSource protocol, and destination objects (receivers of a drop) conform to the NSDraggingDestination protocol. AppKit hides all the details of tracking the cursor and displaying the dragged image.


The NSPrinter, NSPrintPanel, NSPageLayout, and NSPrintInfo classes work together to provide the means for printing the information that your application displays in its windows and views. You can also create an EPS representation of an NSView.

Accessing the File System

Use the NSFileWrapper class to create objects that correspond to files or directories on disk. NSFileWrapper will hold the contents of the file in memory so that it can be displayed, changed, or transmitted to another application. It also provides an icon for dragging the file or representing it as an attachment. Or use the NSFileManager class in the Foundation framework to access and enumerate file and directory contents. The NSOpenPanel and NSSavePanel classes also provide a convenient and familiar user interface to the file system.

Sharing Data With Other Applications

The NSPasteboard class defines the pasteboard, a repository for data that’s copied from your application, making this data available to any application that cares to use it. NSPasteboard implements the familiar cut-copy-paste operation. The NSServicesRequest protocol uses the pasteboard to communicate data that’s passed between applications by a registered service.

Checking Spelling

The NSSpellServer class lets you define a spell-checking service and provide it as a service to other applications. To connect your application to a spell-checking service, you use the NSSpellChecker class. The NSIgnoreMisspelledWords and NSChangeSpelling protocols support the spell-checking mechanism.


If an application is to be used in more than one part of the world, its resources may need to be customized, or “localized,” for language, country, or cultural region. For example, an application may need to have separate Japanese, English, French, and German versions of character strings, icons, nib files, or context help. Resource files specific to a particular language are grouped together in a subdirectory of the bundle directory (the directories with the “.lproj” extension). Usually you set up localization resource files using Interface Builder. See the specifications for NSBundle AppKit Additions Reference and Bundle class for more information on localization (NSBundle is in the Foundation framework).




The NSAccessibilityElement class provides the basic infrastructure required to interact with an accessibility client. Create subclasses of the NSAccessibilityElement class to represent any of your accessibility elements that do not inherit from NSView or from one of the standard AppKit controls. This subclass will represent your element in the accessibility hierarchy. Additionally, your subclass should adopt one of the role-based protocols. For a list of role-based protocols, see NSAccessibility.


An NSActionCell defines an active area inside a control (an instance of NSControl or one of its subclasses).


An alert appears onscreen either as an app-modal dialog or as a sheet attached to a document window. The methods of the NSAlert class allow you to specify alert level, alert text, button titles, and a custom icon should you require it. The class also lets your alerts display a help button and provides ways for apps to offer help specific to an alert.


An NSAlignmentFeedbackFilter object filters the movement of an object and provides haptic feedback when alignment occurs.


Objects of the NSAnimation class manage the timing and progress of animations in the user interface. The class also lets you link together multiple animations so that when one animation ends another one starts. It does not provide any drawing support for animation and does not directly deal with views, targets, or actions.


NSAnimationContext is analogous to CATransaction and are similar in overall concept to NSGraphicsContext. Each thread maintains its own stack of nestable NSAnimationContext instances, with each new instance initialized as a copy of the instance below (so, inheriting its current properties).


An NSAppearance object represents a file that specifies a standard appearance that applies to a subset of UI elements in an app. An app can contain multiple appearance files and—because NSAppearance conforms to NSCoding—you can use Interface Builder to assign UI elements to an appearance.


An NSApplication object manages an app’s main event loop in addition to resources used by all of that app’s objects.


NSArrayController is a bindings compatible class that manages a collection of objects. Typically the collection is an array, however, if the controller manages a relationship of a managed object (see NSManagedObject) the collection may be a set. NSArrayController provides selection management and sorting capabilities.


NSATSTypesetter is a concrete subclass of NSTypesetter that places glyphs during the text layout process. The typesetter creates line fragment rectangles, positions glyphs within the line fragments, determines line breaks by word wrapping and hyphenation, and handles tab positioning.


An NSBezierPath object allows you to create paths using PostScript-style commands. Paths consist of straight and curved line segments joined together. Paths can form recognizable shapes such as rectangles, ovals, arcs, and glyphs; they can also form complex polygons using either straight or curved line segments. A single path can be closed by connecting its two endpoints, or it can be left open.


The NSBitmapImageRep class renders an image from bitmap data. Supported bitmap data formats include GIF, JPEG, TIFF, PNG, and various permutations of raw bitmap data.


The NSBox class implements simple views that can title themselves and draw a border around their content. These objects are known as boxes. You can use box to group, visually, some number of other views.


This class provides a user interface for displaying and selecting items from a list of data or from hierarchically organized lists of data such as directory paths. Instances of this class are known as browsers. When working with a hierarchy of data, the levels are displayed in columns, which are indexed from left to right.


The NSBrowserCell class is the subclass of NSCell used by default to display data in the columns of an NSBrowser object. (Each column contains an NSMatrix filled with NSBrowserCell objects.)


NSButton is a subclass of the NSControl class. An NSButton object sends an action message to a target object, such as a view controller, when the button is clicked. When configured as continuous, the button continues to send repeating action messages at timed intervals until released.


The NSButtonCell class is a subclass of NSActionCell. An NSButtonCell object defines the user interface of a button, checkbox (switch), radio button, and any other clickable region of a view. For example, the NSButton subclass of NSControl uses a single NSButtonCell object to implement its user interface. The configuration of the NSButtonCell object controls how the NSButton object appears and behaves, but the NSButton object is what sends a message when clicked.


The NSCell class provides a mechanism for displaying text or images in an NSView object without the overhead of a full NSView subclass. It’s used heavily by most of the NSControl classes to implement their internal workings.


An NSCIImageRep object can render an image from a Core Image CIImage instance. For more information about the CIImage class and Core Image, see Core Image Programming Guide.


An NSClickGestureRecognizer object is a discrete gesture recognizer that tracks a specified number of mouse clicks. When configuring this gesture recognizer, you can specify which mouse buttons must be clicked and how many clicks must occur before the action method is called. The user must click the specified mouse button the required number of times without dragging the mouse for the gesture to be recognized.


An NSClipView holds the document view of an NSScrollView, clipping the document view to its frame, handling the details of scrolling in an efficient manner, and updating the NSScrollView when the document view’s size or position changes. You don’t normally use the NSClipView class directly; it’s provided primarily as the scrolling machinery for the NSScrollView class. However, you might use the NSClipView class to implement a class similar to NSScrollView.


An NSCollectionView object displays an ordered collection of data items using a customizable layout. The simplest type of collection view displays its items in a grid, but you can define layouts to arrange items however you like. For example, you might create a layout where items are arranged in a circle. You can also change layouts dynamically at runtime whenever you need to present items differently.


The NSCollectionViewFlowLayout class is a concrete layout object that organizes items into a flexible and configurable grid-like arrangement. In a flow layout, the first item is positioned in the top-left corner and other items are laid out either horizontally or vertically based on the scroll direction, which is configurable. Items may be the same size or different sizes, and you may use the flow layout object or the collection view’s delegate object to specify the size of items and the spacing around them. The flow layout also lets you specify custom header and footer views for each section.


An NSCollectionViewFlowLayoutInvalidationContext object identifies the portions of an NSCollectionViewFlowLayout object that need to be updated. Layout objects use invalidation contexts to optimize the layout process and avoid unnecessary work. You use this class to specify whether the flow layout should fetch new size information from its delegate. You can also prevent the flow layout object from updating its layout information altogether.


An NSCollectionViewGridLayout object displays a single section of items in a row and column grid layout. This layout object provides the same layout behavior offered by the NSCollectionView class prior to OS X 10.11, and you can use it in cases where you want to maintain the old appearance while still taking advantage of newer collection view features.


An NSCollectionViewItem object provides the visual representation for a single data element in a collection view. Item objects are view controllers, and you use their view hierarchies to display your content. The default implementation of this class supports the creation of a simple item that displays a single image or string. If the appearance or layout of your items is more sophisticated, you can subclass and configure the view hierarchy based on your needs.


The NSCollectionViewLayout class is an abstract base class that you subclass and use to generate layout information for a collection view. The job of a layout object is to perform the calculations needed to determine the placement and appearance of items, supplementary views, and other content in the collection view. The layout object does not apply the layout attributes it generates to the views in your interface. Instead, it passes those layout attributes to the collection view, which then creates the needed views and applies the layout attributes to them.


An NSCollectionViewLayoutAttributes object contains layout-related attributes for an element in a collection view. During the layout, the layout object creates instances of this class for each element displayed in the collection view. The layout attributes describe the position of an element and other information such as its alpha and position on the z axis. The collection view later applies the layout attributes to the onscreen elements.


An NSCollectionViewLayoutInvalidationContext object identifies the portions of your layout that need to be updated. Invalidation contexts are a way to improve the efficiency of layout operations and must be supported explicitly by the layout object. Instead of invalidating the entire layout, you can create an invalidation layout object that specifies only the portions of the layout that changed. You then pass that invalidation context to the invalidateLayout(with:) method of the layout object.


A UICollectionViewTransitionLayout object implements custom behaviors when changing from one layout to another in a collection view. Transition layouts are commonly used to implement interactive transitions between layouts, where the transition itself is driven by a gesture recognizer.


An NSCollectionViewUpdateItem object describes a single change to make to an item in a collection view. You do not create instances of this class directly. When updating its content, the collection view object creates them and passes them to the layout object’s prepare(forCollectionViewUpdates:) method, which can use them to prepare for the upcoming changes.


A NSColor object stores color data and sometimes opacity (alpha value). Many methods in AppKit require you to specify color data using a NSColor object; when drawing you use them to set the current fill and stroke colors. Color objects are immutable and can be used safely from multiple threads in your app.


An NSColorList object is an ordered list of NSColor objects, identified by keys. Instances of NSColorList, or more simply color lists, are used to manage named lists of NSColor instances. The NSColorPanel list mode color picker uses instances of NSColorList to represent any lists of colors that come with the system, as well as any lists created by the user. An application can use NSColorList to manage document-specific color lists.


The NSColorPanel class provides a standard user interface for selecting color in an application. It provides a number of standard color selection modes and, with the NSColorPickingDefault and NSColorPickingCustom protocols, allows an application to add its own color selection modes. It allows the user to save swatches containing frequently used colors.


The NSColorPicker class is an abstract superclass that implements the NSColorPickingDefault protocol. The NSColorPickingDefault and NSColorPickingCustom protocols define a way to add color pickers (custom user interfaces for color selection) to the NSColorPanel.


The NSColorSpace class enables the creation of objects representing custom color spaces. You can make custom color spaces from ColorSync profiles or from ICC profiles. NSColorSpace also has factory methods that return objects representing the system color spaces.


An NSColorWell object is an NSControl for selecting and displaying a single color value. An example of an NSColorWell object (or simply color well) is found in an NSColorPanel, which uses a color well to display the current color selection. A color well is available from the Palettes panel of Interface Builder.


An NSComboBox is a kind of control that allows you to enter text directly (as you would with an NSTextField) or click the attached arrow at the right of the combo box and select from a displayed (“pop-up”) list of items.


NSComboBoxCell is a subclass of NSTextFieldCell used to implement the user interface of “combo boxes” (see NSComboBox for information on how combo boxes look and work). The NSComboBox subclass of NSTextField uses a single NSComboBoxCell, and essentially all of the NSComboBox class’s methods simply invoke the corresponding NSComboBoxCell method.


NSControl is an abstract superclass that provides three fundamental features for implementing user interface devices: drawing devices on the screen, responding to user events, and sending action messages. It works closely with the NSCell class.


The NSController class is an abstract class that implements the NSEditor and NSEditorRegistration informal protocols required for controller classes.


Instances of the NSCursor class manage the appearance of the cursor.


An NSCustomImageRep object uses a delegate object to render an image. When called upon to produce an image, it sends a message to its delegate to do the actual drawing. You can use this class to support custom image formats without going to the trouble of subclassing NSImageRep directly.


The NSDataAsset class enables you to access an object from a data set type stored in an asset catalog. The object’s content is stored as a set of one or more files with associated device attributes. These sets can also be tagged for use as on-demand resources.


NSDatePicker is a subclass of NSControl that provides a user interface for displaying and editing an NSDate object.


An NSDatePickerCell instance controls the behavior of an NSDatePicker control, or of a single date picker cell in a matrix.


NSDictionaryController is a bindings compatible class that manages display and editing of the contents of an NSDictionary object. NSDictionaryController transforms the contents of a dictionary into an array of key-value pairs that can be bound to user interface items such as the columns of an NSTableView.


The NSDockTile class lets you customize the visual representation for your application’s miniaturized windows and application icon as they appear in the Dock. You do not create Dock tile objects explicitly in your application. Instead, you retrieve the Dock tile for an existing window or for the application by calling that object’s dockTile method.


The NSDocument abstract class defines the interface for macOS documents. A document is an object that can internally represent data displayed in a window and that can read data from and write data to a file or file package. Documents create and manage one or more window controllers and are in turn managed by a document controller. Documents respond to first-responder action messages to save, revert, and print their data.


An NSDocumentController object manages an application’s documents. As the first-responder target of New and Open menu commands, it creates and opens documents and tracks them throughout a session of the application. When opening documents, an NSDocumentController runs and manages the modal Open panel. NSDocumentController objects also maintain and manage the mappings of document types, extensions, and NSDocument subclasses as specified in the CFBundleDocumentTypes property loaded from the information property list (Info.plist).


The NSDraggingImageComponent class represents a single object in a dragging item.


The NSDraggingItem class encompasses a single dragged item within an NSDraggingSession instance.


The NSDraggingSession class encompases a drag and drop action and allows modification of the drag while in progress.


An NSDrawer object is a user interface element that contains and displays view objects including NSTextView, NSScrollView, NSBrowser, and other classes that inherit from NSView. A drawer is associated with a window, called its parent, and can appear only while its parent is visible onscreen. A drawer cannot be moved or ordered independently of a window, but is instead attached to one edge of its parent and moves along with it.


An NSEPSImageRep object can render an image from encapsulated PostScript (EPS) code.


An NSEvent object, or simply an event, contains information about an input action such as a mouse click or a key press. AppKit associates each such user action with a window, reporting the event to the application that created the window. The NSEvent object contains pertinent information about each event, such as where the cursor was located or which character was typed. As the application receives events, it temporarily places them in a buffer called the event queue. When the application is ready to process an event, it takes one from the queue.


NSFont objects represent fonts to an application, providing access to characteristics of the font and assistance in laying out glyphs relative to one another. Font objects are also used to establish the current font for drawing text directly into a graphics context, using the set() method.


The NSFontCollection class represents a font collection, that is, a group of font descriptors taken together as a single object. You can publicize the font collection as a named collection and it is presented through the System user interface such as the font panel & Font Book. The queries can be modifed using the NSMutableFontCollection subclass.


NSFontDescriptor objects provide a mechanism to describe a font with a dictionary of attributes. This font descriptor can be used later to create or modify an NSFont object. macOS 10.4 and later provides a font matching capability, so that you can partially describe a font by creating a font descriptor with, for example, just a family name. You can then find all the available fonts on the system with a matching family name using matchingFontDescriptors(withMandatoryKeys:).


NSFontManager is the center of activity for the font conversion system. It records the currently selected font, updates the Font panel and Font menu to reflect the selected font, initiates font changes, and converts fonts in response to requests from text-bearing objects. In a more prosaic role, NSFontManager can be queried for the fonts available to the application and for the particular attributes of a font, such as whether it’s condensed or extended.


The NSFontPanel class implements the Font panel—a user interface object that displays a list of available fonts, letting the user preview them and change the font used to display text. The actual changes are made through conversion messages sent to the shared NSFontManager instance. There’s only one Font panel for each application.


An NSForm object is a vertical matrix of NSFormCell objects to implement the fields.


The NSFormCell class is used to implement text entry fields in a form. The left part of an NSFormCell object contains a title. The right part contains an editable text entry field.


An NSGestureRecognizer object monitors events and calls its action method when a predefined sequence of events occur. For example, a gesture recognizer might recognize a single click, a click and drag, or a sequence of events that imply rotation. You do not create instances of this class directly. This class is an abstract base class that defines the common behavior for all gesture recognizers. When using a gesture recognizer in your app, create an instance of one of the concrete subclasses.


An NSGlyphGenerator object performs the initial, nominal glyph generation phase in the layout process.


An NSGlyphInfo object represents a glyph attribute value (NSGlyphInfoAttributeName) in an attributed string (NSAttributedString). Glyphs are the graphic representations of characters, stored in a font, that the text system draws on a display or printed page. Before text can be laid out, the layout manager (NSLayoutManager) generates a stream of glyphs to be laid out, using character and font information specified by the attributed string and contained in the font file. NSGlyphInfo provides a means to override the standard glyph generation process and substitute a specified glyph over the attribute’s range.


The NSGradient class provides support for drawing gradient fill colors, also known as shadings in Quartz. This class provides convenience methods for drawing radial or linear (axial) gradients for rectangles and NSBezierPath objects. It also supports primitive methods that let you customize the shape of the gradient fill.


The NSGraphicsContext class is the programmatic interface to objects that represent graphics contexts. A context can be thought of as a destination to which drawing and graphics state operations are sent for execution. Each graphics context contains its own graphics environment and state.


An NSHapticFeedbackManager object allows you to access haptic feedback management attributes on a system with a Force Touch trackpad.


The NSHelpManager class provides an approach to displaying online help. An application contains one NSHelpManager object.


A high-level interface for manipulating image data.


An NSImageCell object displays a single image (encapsulated in an NSImage object) in a frame. This class provides methods for choosing the frame and for aligning and scaling the image to fit the frame.


The NSImageRep class is a semiabstract superclass (“semi” because it has some instance variables and implementation of its own). Each of its subclasses knows how to draw an image from a particular kind of source data. While an NSImageRep subclass can be used directly, it is typically through an NSImage object. An NSImage object manages a group of image representations, choosing the best one for the current output device.


An NSImageView object displays image data from an NSImage object in a frame. An editable image view object behaves as an image well and supports copying, pasting, dragging, and using the Delete key to clear its content. Note that an image view performs its action only when it’s editable and a user drags an image to it. To allow users to perform a custom action when they click an image, use a button.


The NSLayoutAnchor class is a factory class for creating NSLayoutConstraint objects using a fluent API. Use these constraints to programatically define your layout using Auto Layout.


A constraint defines a relationship between two user interface objects that must be satisfied by the constraint-based layout system. Each constraint is a linear equation with the following format:


The NSLayoutDimension class is a factory class for creating size-based NSLayoutConstraint objects using a fluent API. Use these constraints to programatically define your layout using Auto Layout. All sizes are measured in points.


The NSLayoutGuide class defines a rectangular area that can interact with Auto Layout. Use layout guides to replace the dummy views you may have created to represent inter-view spaces or encapsulation in your user interface.


An NSLayoutManager object coordinates the layout and display of characters held in an NSTextStorage object. It maps Unicode character codes to glyphs, sets the glyphs in a series of NSTextContainer objects, and displays them in a series of NSTextView objects. In addition to its core function of laying out text, an NSLayoutManager object coordinates its NSTextView objects, provides services to those text views to support NSRulerView instances for editing paragraph styles, and handles the layout and display of text attributes not inherent in glyphs (such as underline or strikethrough). You can create a subclass of NSLayoutManager to handle additional text attributes, whether inherent or not.


The NSLayoutXAxisAnchor class is a factory class for creating horizontal NSLayoutConstraint objects using a fluent interface (an interface designed to produce more readable code). Use these constraints to programatically define your layout using Auto Layout.


The NSLayoutYAxisAnchor class is a factory class for creating vertical NSLayoutConstraint objects using a fluent interface (an interface designed to produce more readable code). Use these constraints to programatically define your layout using Auto Layout.


NSLevelIndicator is a subclass of NSControl that displays a value on a linear scale.


NSLevelIndicatorCell is a subclass of NSActionCell that provides several level indicator display styles including: capacity, ranking and relevancy. The capacity style provides both continuous and discrete modes.


An NSMagnificationGestureRecognizer object is a continuous gesture recognizer that tracks a pinch gesture used to magnify content. This object tracks pinch gestures on a track pad or other input device and stores the resulting magnification value for you to use in your code.


NSMatrix is a class used for creating groups of NSCell objects that work together in various ways.


An NSMediaLibraryBrowserController instance configures and displays a Media Library Browser panel. From this panel a user can drag media into views in their app. The class provides a standard interface to the MediaLibrary framework content.


An NSMenu object manages an application’s menus.


The NSMenuItem class defines objects that are used as command items in menus. Additionally, the NSMenuItem class also includes some private functionality needed to maintain binary compatibility with other components of Cocoa. Because of this fact, you cannot replace the NSMenuItem class with a different class. You may, however, subclass NSMenuItem if necessary.


NSMenuItemCell is a class that handles the measurement and display of a single menu item in its encompassing frame. Instances of NSMenuItemCell work in conjunction with an NSMenuView object to control the overall appearance of the menu.


NSMutableFontCollection is a dedicated class that represents a mutable collection of fonts. This subclass is used to create a modifiable version of the NSFontCollection class. Using this class allows you to modify the search queries for the font descriptors used by the parent NSFontCollection class.


The NSMutableParagraphStyle class adds methods to its superclass, NSParagraphStyle, for changing the values of the subattributes in a paragraph style attribute. See the NSParagraphStyle and NSAttributedString specifications for more information.


Instances of the NSNib class serve as object wrappers, or containers, for Interface Builder nib files. An NSNib object keeps the contents of a nib file resident in memory, ready for unarchiving and instantiation.


NSObjectController is a Cocoa bindings-compatible controller class. Properties of the content object of instances of this class can be bound to user interface elements to access and modify their values.


All OpenGL calls are rendered into an OpenGL graphics context, which in Cocoa is represented by the NSOpenGLContext class. The context is created using an NSOpenGLPixelFormatobject that specifies the context’s buffer types and other attributes. A context can be full-screen, offscreen, or associated with an NSView object. A context draws into its drawable object, which is the frame buffer that is the target of OpenGL drawing operations.


NSOpenGLLayer is a subclass of CAOpenGLLayer that is suitable for rendering OpenGL into layers. Unlike CAOpenGLLayer, NSOpenGLLayer uses distinctly Application Kit types.


To render with OpenGL into an NSOpenGLContext, you must specify the context’s pixel format. An NSOpenGLPixelFormat object specifies the types of buffers and other attributes of the NSOpenGLContext. This class is similar to the AGLPixelFormat type, which is used in Carbon OpenGL applications.


An NSOpenGLView object maintains an NSOpenGLPixelFormat and NSOpenGLContext object into which OpenGL calls can be rendered. The view provides methods for accessing and managing the NSOpenGLPixelFormat and NSOpenGLContext objects, as well as notifications of visible region changes.


The NSOpenPanel class provides the Open panel for the Cocoa user interface. Applications use the Open panel as a convenient way to query the user for the name of a file to open.


NSOutlineView is a subclass of NSTableView that uses a row-and-column format to display hierarchical data that can be expanded and collapsed, such as directories and files in a file system. A user can expand and collapse rows, edit values, and resize and rearrange columns.


The NSPageController class is used for controlling swipe navigation and animations between views or view content. It is useful for user interfaces which control navigating multiple pages as in a book or a web browser history.


NSPageLayout is a panel that queries the user for information such as paper type and orientation. It is normally displayed in response to the user selecting the Page Setup menu item. You obtain an instance with the pageLayout class method. The pane can then be run as a sheet using beginSheet(with:modalFor:delegate:didEnd:contextInfo:) or modally using runModal() or runModal(with:).


The NSPanel class implements a special kind of window (known as a panel), typically performing an auxiliary function.


An NSPanGestureRecognizer object implements a continuous gesture recognizer for panning (dragging) gestures. The gesture is recognized when the user clicks all of specified buttons, drags the mouse, and releases one or more of the buttons. Use the pan gesture recognizer object to retrieve the distance traveled during the pan and the location of the mouse as it pans.


The NSParagraphStyle class and its subclass NSMutableParagraphStyle encapsulate the paragraph or ruler attributes used by the NSAttributedString classes. Instances of these classes are often referred to as paragraph style objects or, when no confusion will result, paragraph styles.


NSPasteboard objects transfer data to and from the pasteboard server. The server is shared by all running apps. It contains data that the user has cut or copied, as well as other data that one application wants to transfer to another. NSPasteboard objects are an application’s sole interface to the server and to all pasteboard operations.


NSPasteboardItem is a generic class to represent an item on a pasteboard.


NSPathCell implements the user interface of an NSPathControl object. It maintains a collection of NSPathComponentCell objects that represent a particular path to be displayed to the user.


The NSPathComponentCell class displays a component of a path.


NSPathControl is a subclass of NSControl that represents a file system path or virtual path.


An NSPDFImageRep object can render an image from a PDF format data stream.


An NSPDFInfo object stores information associated with the creation of a PDF file, such as its URL, tag names, page orientation, and paper size. Typically, a PDF panel—that is, a panel created by an NSPDFPanel object—displays the information supplied by an NSPDFInfo object when the user wants to export content as a PDF file. A PDF panel can also update an NSPDFInfo object with information it receives from the user.


An NSPDFPanel object is used to implement a Save or Export as PDF panel that’s consistent with the macOS user interface. A PDF panel has a variety of built-in customization controls, such as page orientation, paper size, and tags. It also supports the use of a custom accessory view controller that allows an app to specify how a PDF file should be created.


The NSPersistentDocument class is a subclass of NSDocument that is designed to easily integrate into the Core Data framework. It provides methods to access a document-wide NSManagedObjectContext object, and provides default implementations of methods to read and write files using the persistence framework. In a persistent document, the undo manager functionality is taken over by managed object context.


An NSPICTImageRep object renders an image from a PICT format data stream as described in the Carbon QuickDraw Manager documentation. This class can render PICT format version 1, version 2, and extended version 2 pictures.


The NSPopover class provides a means to display additional content related to existing content on the screen. The popover is positioned relative to the existing content.


The NSPopUpButton class defines objects that implement the pop-up and pull-down menus of the graphical user interface.


The NSPopUpButtonCell class defines the visual appearance of pop-up buttons that display pop-up or pull-down menus. Pop-up menus present the user with a set of choices, much the way radio buttons do, but using much less space. Pull-down menus also provide a set of choices but present the information in a slightly different way, usually to provide a set of commands from which the user can choose.


NSPredicateEditor is a subclass of NSRuleEditor that is specialized for editing NSPredicate objects.


NSPredicateEditorRowTemplate describes available predicates and how to display them.


An NSPressGestureRecognizer object is a discrete gesture recognizer that tracks whether the user held a mouse button down for a minimum amount of time before releasing it. Use a press gesture recognizer to configure which button must be held and the amount of time for which it must be held. You can also specify how far the mouse is allowed to move and still be considered a valid gesture.


Use an NSPressureConfiguration object to configure the behavior and progression of a Force Touch trackpad when it responds to a mouse drag or pressure event sequence. Pressure configurations are assigned to views (NSView) and gesture recognizers (NSGestureRecognizer).


An NSPrinter object describes a printer’s capabilities. It provides information about a printer; it does not modify printer attributes or control a printing job. An NSPrinter object can be constructed by specifying either the printer name or the make and model of an available printer.


An NSPrintInfo object stores information that’s used to generate printed output. A shared NSPrintInfo object is automatically created for an application and is used by default for all printing jobs for that application.


An NSPrintOperation object controls operations that generate Encapsulated PostScript (EPS) code, Portable Document Format (PDF) code, or print jobs. An NSPrintOperation object works in conjunction with two other objects: an NSPrintInfo object, which specifies how the code should be generated, and an NSView object, which generates the actual code.


An NSPrintPanel object creates the Print panel used to query the user for information about a print job. This panel may lets the user select the range of pages to print and the number of copies before executing the Print command.


The NSProgressIndicator class lets an app display a progress indicator to show that a lengthy task is under way. Some progress indicators are indeterminate and do nothing more than show that the app is busy. Others are determinate and show the percentage of the task that has been completed.


NSResponder is an abstract class that forms the basis of event and command processing in AppKit. The core classes—NSApplication, NSWindow, and NSView—inherit from NSResponder, as must any class that handles events. The responder model is built around three components: event messages, action messages, and the responder chain.


An NSRotationGestureRecognizer object is a continuous gesture recognizer that tracks two trackpad touches moving opposite each other in a circular motion. This rotation gesture implies that the underlying view should rotate in a matching direction. The gesture is recognized when the trackpad touches end.


An NSRuleEditor object is a view that allows the user to visually create and configure a list of options which are expressed by the rule editor as a predicate (see Predicate Programming Guide). The view has a delegate which offers a tree of choices to the view. The choices are presented by the view to the user as a row of popup buttons, static text fields, and custom views. Each row in the list represents a particular path down the tree of choices.


An NSRulerMarker object displays a symbol on an NSRulerView object, indicating a location for whatever graphics element it represents in the client of the ruler view (for example, a margin or tab setting, or the edges of a graphic on the page).


An NSRulerView displays a ruler and markers above or to the side of an NSScrollView’s document view. Views within the NSScrollView can become clients of the ruler view, having it display markers for their elements, and receiving messages from the ruler view when the user manipulates the markers.


NSRunningApplication is a class to manipulate and provide information for a single instance of an application. Only user applications are tracked; this does not provide information about every process on the system.


An NSSavePanel object creates and manages a Save panel and allows you to run the panel in a modal loop. The Save panel provides a simple way for a user to specify a file to use when saving a document or other data. It can restrict the user to files of a certain type, as specified by an extension.


An NSScreen object describes the attributes of a computer’s monitor, or screen. An application may use an NSScreen object to retrieve information about a screen and use this information to decide what to display upon that screen. For example, an application may use the deepest() method to find out which of the available screens can best represent color and then may choose to display all of its windows on that screen.


An NSScroller object controls scrolling of a document view within the clip view of an NSScrollView instance (or potentially of another kind of container view). A scroller displays a slot containing a knob that the user can drag directly to the desired location. The knob indicates both the position within the document view and—by varying in size within the slot—the amount visible relative to the size of the document view.


The NSScrollView class is the central coordinator for the Application Kit’s scrolling machinery, composed of this class, and the NSClipView, and NSScroller classes. A scroll view displays a portion of a document view that’s too large to be displayed whole and provides scroll bars that allow the user to move the document view within the scroll view.


An NSSearchField object implements a text field control that is optimized for performing text-based searches. The control provides a customized text field for entering search data, a search button, a cancel button, and a pop-up icon menu for listing recent search strings and custom search categories.


The NSSearchFieldCell class defines the programmatic interface for text fields that are optimized for text-based searches. An NSSearchFieldCell object is “wrapped” by an NSSearchField control object, which directly inherits from the NSTextField class. The search field implemented by these classes presents a standard user interface for searches, including a search button, a cancel button, and a pop-up icon menu for listing recent search strings and custom search categories.


NSSecureTextField is a subclass of NSTextField that hides its text from display or other access via the user interface. It’s suitable for use as a password-entry object or for any item in which a secure value must be kept.


NSSecureTextFieldCell works with NSSecureTextField to provide a text field whose value is guarded from user examination. It overrides the general cell use of the field editor to provide its own field editor, which doesn’t display text or allow the user to cut or copy its value.


An NSSegmentedCell object implements the appearance and behavior of a horizontal button divided into multiple segments. This class is used in conjunction with the NSSegmentedControl class to implement a segmented control.


An NSSegmentedControl object implements a linear set of two or more segments, each of which functions as a button.


An NSShadow object encapsulates the attributes used to create a drop shadow during drawing operations.


The NSSharingService class is used to provide a consistent user experience when sharing items in macOS. For example, items can be: NSURL objects, NSString objects, NSImage objects, video (through file URLs), or any object which implements the NSPasteboardWriting protocol.


The NSSharingServicePicker class presents a list of sharing services, so that the user can choose a service to share an item. When a service is chosen, the picker automatically executes it, which presents the sharing window.


A slider is a UI element that displays a range of values in the app. Sliders can be vertical or horizontal bars or circular dials. An indicator, or knob, notes the current setting. The user can move the knob in the slider’s bar—or rotate the knob in a circular slider—to change the setting.


An NSSliderCell object controls the appearance and behavior of an NSSlider object, or of a single slider in an NSMatrix object.


The NSSound class provides a simple interface for loading and playing audio files. This class supports the same audio encodings and file formats that are supported by Core Audio and QuickTime.


The NSSpeechRecognizer class is the Cocoa interface to Speech Recognition in macOS. This class provides a “command and control” style of voice recognition system, where the command phrases must be defined prior to listening, in contrast to a dictation system where the recognized text is unconstrained.


The NSSpeechSynthesizer class is the Cocoa interface to Speech Synthesis in macOS. Instances of this class are called speech synthesizers.


The NSSpellChecker class provides an interface to the Cocoa spell-checking service. To handle all its spell checking, an application needs only one instance of NSSpellChecker, known as the spell checker. Through the spell checker you manage the Spelling panel, in which the user can specify decisions about words that are suspect.


A split view manages the dividers and orientation for a split view controller (an instance of the NSSplitViewController class.) By default, dividers are oriented horizontally so that sibling views are arranged vertically, from top to bottom, in the containing split view controller.


A split view controller manages an array of adjacent child views, and has a split view object for managing dividers between those views.


A stack view employs Auto Layout (the system’s constraint-based layout feature) to arrange and align an array of views according to your specification. To use a stack view effectively, you need to understand the basics of Auto Layout constraints as described in Auto Layout Guide.


The NSStatusBar class defines an object that manages a collection of NSStatusItem objects displayed within the system-wide menu bar. A status item can be displayed with text or an icon, can provide a menu and a target-action message when clicked, or can be a fully customized view that you create.


The NSStatusItem class represents the individual elements displayed within an NSStatusBar object. Instances are created by the NSStatusBar method statusItem(withLength:), which automatically adds the new status item to the status bar. The appearance and behavior of the status item are then set using the button property. (For additional guidance, see Menu Bar Extras.)


A stepper consists of two small arrows that can increment and decrement a value that appears beside it, such as a date or time. The illustration below shows a stepper to the right of a text field, which would show the stepper’s value.


An NSStepperCell object controls the appearance and behavior of an NSStepper object.


A storyboard encapsulates the design-time view controller and window controller graph represented in an Interface Builder storyboard resource file. In the context of a storyboard file, each contained controller is called a scene.


A storyboard segue specifies a transition or containment relationship between two scenes in a storyboard, where a scene is a view controller or a window controller and a storyboard is an instance of the NSStoryboard class.


The NSStringDrawingContext class manages metrics used when drawing attributed strings. Prior to drawing, you can create an instance of this class and use it to specify the minimum scale factor and tracking adjustments for a string. After drawing, you can retrieve the actual values that were used during drawing.


The NSTableCellView class is a reusable container view shown for a particular cell in an NSTableView instance that uses rows for content. The imageView and textField properties are connected in Interface Builder. Additional properties can be added by subclassing NSTableCellView and adding the required properties and connecting them programmatically or in Interface Builder.


The NSTableColumn class stores the display characteristics and identifier for a column in an NSTableView instance. A table column object determines the width (including the maximum and minimum widths) of its column in the table view and specifies the column’s resizing and editing behavior.


The NSTableHeaderCell class is used by an NSTableHeaderView instance to draw the content of the column headers. This specific subclass is responsible for drawing the sort indicators.


An NSTableHeaderView is used by an NSTableView to draw headers over its columns and to handle mouse events in those headers.


The NSTableRowView class is the view shown for a row in an NSTableView. It is responsible for displaying attributes associated with the row, including the selection highlight, and group row look.


An NSTableView object displays data for a set of related records, with rows representing individual records and columns representing the attributes of those records.


An NSTableViewRowAction object defines a single action to present when the user swipes horizontally on a table row. In an editable table, performing a horizontal swipe on a row reveals a button to delete the row by default. This class lets you define one or more custom actions to display for a given row in your table. Each instance of this class represents a single action to perform and includes the text, formatting information, and behavior for the corresponding button.


An NSTabView object provides a convenient way to present information in multiple pages. The view contains a row of tabs that give the appearance of folder tabs, as shown in the following figure. The user selects the desired page by clicking the appropriate tab or using the arrow keys to move between pages. Each page displays a view hierarchy provided by your application.


An NSTabViewController object is a container view controller that manages a tab view interface, which organizes multiple pages of content but displays only one of those pages at a time. Each page of content is managed by a separate child view controller. Navigation between child view controllers is accomplished with the help of an NSTabView object, which the tab view controller manages. When the user selects a new tab, the tab view controller displays the content associated with the associated child view controller, replacing the previous content.


An NSTabViewItem is a convenient way for presenting information in multiple pages. A tab view is usually distinguished by a row of tabs that give the visual appearance of folder tabs. When the user clicks a tab, the tab view displays a view page provided by your application. A tab view keeps a zero-based array of NSTabViewItems, one for each tab in the view.


NSText declares the most general programmatic interface for objects that manage text. You usually use instances of its subclass, NSTextView.


NSTextAlternatives is an immutable value class that stores a list of alternatives for a piece of text and communicates the user’s selection of an alternative via a notification to your app. To support dictation, for example, you might use NSTextAlternatives to present a list of alternative interpretations for a word or phrase the user speaks. If the user chooses to replace the initial interpretation with an alternative, NSTextAlternatives notifies you of the choice so that you can update the text appropriately.


NSTextAttachment objects are used by the NSAttributedString class cluster as the values for attachment attributes (stored in the attributed string under the key named NSAttachmentAttributeName). The objects you create with this class are referred to as text attachment objects, or when no confusion will result, as text attachments or merely attachments.


NSTextAttachmentCell implements the functionality of the NSTextAttachmentCell protocol.


NSTextBlock objects represent a block of text laid out in a subregion of the text container. Text blocks appear as attributes on paragraphs, as part of the paragraph style.


The NSTextContainer class defines a region where text is laid out. An NSLayoutManager uses NSTextContainer to determine where to break lines, lay out portions of text, and so on. An NSTextContainer object normally defines rectangular regions, but you can define exclusion paths inside the text container to create regions where text does not flow. You can also subclass to create text containers with nonrectangular regions, such as circular regions, regions with holes in them, or regions that flow alongside graphics.


An NSTextField object is a kind of NSControl that displays text that the user can select or edit and that sends its action message to its target when the user presses the Return key while editing.


The NSTextFieldCell class adds to the text display capabilities of the NSCell class by allowing you to set the color of both the text and its background. You can also specify whether the cell draws its background at all.


The NSTextFinder class provides an optional search and replace find-bar interface inside a view, usually a scroll view.


An NSTextInputContext object represents the Cocoa text input system. The text input system communicates primarily with the client of the activated input context via the NSTextInputClient protocol.


An NSTextList object represents a section of text that forms a single list. The visible elements of the list, including list markers, appear in the text as they do for lists created by hand. The list object, however, allows the list to be recognized as such by the text system. This enables automatic creation of markers and spacing. Text lists are used in HTML import and export.


The NSTextStorage class defines the fundamental storage mechanism of TextKit. This class is a semi concrete subclass of NSMutableAttributedString that adds behavior for managing a set of client NSLayoutManager objects. A text storage object notifies its layout managers of changes to its characters or attributes, which lets the layout managers redisplay the text as needed.


An NSTextTab object represents a tab in an NSParagraphStyle object, storing an alignment type and location. NSTextTab objects are most frequently used with the TextKit system and with NSRulerView and NSRulerMarker objects.


An NSTextTable object represents a text table as a whole. It is responsible for laying out and drawing the text table blocks it contains, and it maintains the basic parameters of the table.


An NSTextTableBlock object represents a text block that appears as a cell in a text table.


The NSTextView class is the front-end class to the Application Kit’s text system. The class draws the text managed by the back-end components and handles user events to select and modify its text. NSTextView is the principal means to obtain a text object that caters to almost all needs for displaying and managing text at the user interface level. While NSTextView is a subclass of the NSText class—which declares the most general Cocoa interface to the text system—NSTextView adds major features beyond the capabilities of NSText.


An NSTitlebarAccessoryViewController object manages a custom view—known as an accessory view—in the title bar–toolbar area of a window. Because a title bar accessory view controller is contained in a visual effect view (that is, NSVisualEffectView), it automatically handles the blur behind the accessory view and the size and location changes for the content of the view when a window goes in and out of full screen mode. If you’re currently using NSToolbar fullscreen accessory APIs, such as fullScreenAccessoryView, you should use NSTitlebarAccessoryViewController APIs instead.


NSTokenField is a subclass of NSTextField that provides tokenized editing similar to the address field in the Mail application.


NSTokenFieldCell is a subclass of NSTextFieldCell that provides tokenized editing of an array of objects similar to the address field in the Mail application. The objects may be strings or objects that can be represented as strings. A single token field cell can be presented in an NSTokenField control.


NSToolbar and NSToolbarItem provide the mechanism for a titled window to display a toolbar just below its title bar, as shown below:


The NSToolbarItem class defines each item contained within a window’s NSToolbar instance.


NSToolbarItemGroup is a subclass of NSToolbarItem which contains subitems. The views and labels of the subitems are used, but the parent's attributes take precedence.


An instance of the NSTouch class is a snapshot of a particular touch at an instant in time.


An NSTrackingArea object defines a region of view that generates mouse-tracking and cursor-update events when the mouse is over that region.


The NSTreeController is a bindings compatible controller that manages a tree of objects. It provides selection and sort management. Its primary purpose is to act as the controller when binding NSOutlineView and NSBrowser instances to a hierarchical collection of objects. The root content object of the tree can be a single object, or an array of objects.


NSTreeNode simplifies the creation and management of trees of objects. Each tree node represents a model object. A tree node with nil as its parent node is considered the root of the tree.


NSLayoutManager uses concrete subclasses of this abstract class, NSTypesetter, to perform line layout, which includes word wrapping, hyphenation, and line breaking in either vertical or horizontal rectangles. By default, the text system uses the concrete subclass NSATSTypesetter.


NSUserDefaultsController is a Cocoa bindings compatible controller class. Properties of the shared instance of this class can be bound to user interface elements to access and modify values stored in NSUserDefaults.


An NSView object provides the infrastructure for drawing, printing, and handling events in an app. You typically don’t use NSView objects directly. Instead, you use objects whose classes descend from NSView or you subclass NSView yourself and override its methods to implement the behavior you need. An instance of the NSView class (or one of its subclasses) is commonly known as a view object, or simply as a view.


The NSViewAnimation class, a public subclass of NSAnimation, offers a convenient way to animate multiple views and windows. The animation effects you can achieve are limited to changes in frame location and size, and to fade-in and fade-out effects.


A view controller manages a view, typically loaded from a nib file.


NSVisualEffectView provides support for the user interface effects introduced in OS X Yosemite related to translucency, including “vibrant” appearances. To make the contents of a view blend with whatever is behind the view’s window or blend with contents of a view deeper in the view hierarchy, you contain the view in a visual effect view.


The NSWindow class defines objects (known as windows) that manage and coordinate the windows an application displays on the screen.


An NSWindowController object manages a window, usually a window stored in a nib file.


An NSWorkspace object can launch other apps and perform a variety of file-handling services.



The NSAccessibility protocol declares the complete list of properties and methods implemented by accessible elements. In general, your custom user interface elements should not adopt this protocol. Instead, select the role-specific protocol—such as NSAccessibilityButton, NSAccessibilityImage, or NSAccessibilityGroup—that best matches your element’s behavior.


The NSAccessibility informal protocol defines an old, key-based API. For the most part, the use of this API is discouraged. Use the new, method-based API instead. However, there are a few methods and properties that are still relevant. You can combine the accessibilityHitTest(_:) method and the accessibilityFocusedUIElement and accessibilityNotifiesWhenDestroyed properties with the new NSAccessibility protocol. For more information on the new, method-based API see Accessibility Programming Guide for OS X or NSAccessibility.


The NSAccessibilityButton role-based protocol declares the minimum interface required for an accessibility element to act as a button. You can further enhance the adopting element by implementing any of the information properties or action methods declared in the NSAccessibility protocol.


The NSAccessibilityCheckBox role-based protocol declares the minimum interface required for an accessibility element to act as a checkbox. You can further enhance the adopting element by implementing any of the information properties or action methods declared in the NSAccessibility protocol.


The NSAccessibilityContainsTransientUI protocol should be used in addition to another role-based protocol. See NSAccessibility for a list of role-based protocols. This protocol defines the methods needed to support a UI that changes dynamically—usually in response to mouse-over events.


The NSAccessibilityElement role-based protocol declares the minimum interface required to interact with an accessibility client. In general, your user interface elements should not adopt this protocol. They should adopt a more specific, role-based protocol instead. For a list of role-based protocols, see NSAccessibility.


The NSAccessibilityGroup role-based protocol declares the minimum interface required to act as a container for other user interface elements. Use this protocol when you want to logically group a collection of accessibility elements. You can further enhance the adopting element by implementing any of the information properties or action methods declared in the NSAccessibility protocol.


The NSAccessibilityImage role-based protocol declares the minimum interface required for an accessibility element to act as a image. You can further enhance the adopting element by implementing any of the information properties or action methods declared in the NSAccessibility protocol.


The NSAccessibilityLayoutArea role-based protocol declares the minimum interface required for an accessibility element to act as a layout area. Use this protocol when you want to create a canvas that contains layout items. You can further enhance the adopting element by implementing any of the information properties or action methods declared in the NSAccessibility protocol.


The NSAccessibilityLayoutItem role-based protocol declares the minimum interface required for an accessibility element to act as a layout item. Layout items are repositional and resizeable items inside a layout area. You can further enhance the adopting element by implementing any of the information properties or action methods declared in the NSAccessibility protocol.


The NSAccessibilityList role-based protocol declares the minimum interface required for an accessibility element to act as a list view. You can further enhance the adopting element by implementing any of the information properties or action methods declared in the NSAccessibility protocol.


The NSAccessibilityNavigableStaticText role-based protocol declares the minimum interface required for an accessibility element to act as navigable static text. Use this protocol to represent larger blocks of text. The protocol will allow users to navigate through the text a line at a time or a word at a time using an accessibility client. For shorter pieces of text (for example, labels or headers), use the NSAccessibilityStaticText protocol instead. You can further enhance the adopting element by implementing any of the information properties or action methods declared in the NSAccessibility protocol.


The NSAccessibilityOutline role-based protocol declares the minimum interface required for an accessibility element to act as an outline view. You can further enhance the adopting element by implementing any of the information properties or action methods declared in the NSAccessibility protocol.


The NSAccessibilityProgressIndicator role-based protocol declares the minimum interface required for an accessibility element to act as a progress indicator. You can further enhance the adopting element by implementing any of the information properties or action methods declared in the NSAccessibility protocol.


The NSAccessibilityRadioButton role-based protocol declares the minimum interface required for an accessibility element to act as a radio button. You can further enhance the adopting element by implementing any of the information properties or action methods declared in the NSAccessibility protocol.


The NSAccessibilityRow role-based protocol declares the minimum interface required for an accessibility element to act as a row for a table, list our outline view. You can further enhance the adopting element by implementing any of the information properties or action methods declared in the NSAccessibility protocol.


The NSAccessibilitySlider role-based protocol declares the minimum interface required for an accessibility element to act as a slider. You can further enhance the adopting element by implementing any of the information properties or action methods declared in the NSAccessibility protocol.


The NSAccessibilityStaticText role-based protocol declares the minimum interface required for an accessibility element to act as static text. Static text elements are typically used for short pieces of text, such as headers or labels. For longer blocks of text, use the NSAccessibilityNavigableStaticText protocol. You can further enhance the adopting element by implementing any of the information properties or action methods declared in the NSAccessibility protocol.


The NSAccessibilityStepper role-based protocol declares the minimum interface required for an accessibility element to act as a stepper. You can further enhance the adopting element by implementing any of the information properties or action methods declared in the NSAccessibility protocol.


The NSAccessibilitySwitch role-based protocol declares the minimum interface required for an accessibility element to act as a switch. You can further enhance the adopting element by implementing any of the information properties or action methods declared in the NSAccessibility protocol.


The NSAccessibilityTable role-based protocol declares the minimum interface required for an accessibility element to act as a table view. You can further enhance the adopting element by implementing any of the information properties or action methods declared in the NSAccessibility protocol.


The NSAlertDelegate protocol defines the optional methods implemented by delegates of NSAlert objects.


The NSAnimatablePropertyContainer protocol defines a way to add animation to an existing class with a minimum of API impact. It returns a proxy object for the receiver that can be used to initiate implied animation of property changes. An object's animator proxy should be treated as if it was the object itself, and may be passed to any code that accepts the object as a parameter. Sending of key-value-coding compliant "set" messages to the proxy will trigger animation for automatically animated properties of its target object.


The NSAnimationDelegate protocol defines the optional methods implemented by delegates of NSAnimation objects.


Use the NSAppearanceCustomization protocol to get or set the appearance of a view, or to get the appearance that an offscreen view will use when it draws onscreen in the future.


The NSApplicationDelegate protocol defines the methods that may be implemented by delegates of NSApplication objects.


The NSBrowserDelegate protocol defines the method that a delegate of NSBrowser should implement.


This protocol is implemented by objects in the responder chain that can correct a misspelled word. See the NSSpellChecker class description for more information.


An object that adopts the NSCollectionViewDataSource protocol provides the information and view objects required by a collection view to present your content. A data source object vends information about your app’s data model to the collection view when asked. For example, it tells the collection view how many items are present. It also handles the creation and configuration of the views used to represent items and used to decorate the collection view’s content area.


The NSCollectionViewDelegate protocol defines methods for managing the behavior of a collection view. You use the methods of this protocol to facilitate the user-initiated selection and highlighting of items, to track changes to the collection view’s visual elements, and to implement drag and drop support. The methods of this protocol are optional, but for some features, you must implement specific methods to support the feature.


The NSCollectionViewDelegateFlowLayout protocol defines methods for providing layout information to an NSCollectionViewFlowLayout object. Implement the methods of this protocol when you want to customize the layout behavior and perhaps return different values for different items or sections.


The NSCollectionViewElement protocol defines the methods for managing content in a collection view. Adopt this protocol in the classes that you use to display content for items, supplementary views, and decoration views in a collection view. The methods of this protocol are optional and provide support for applying layout attributes and for cleaning up elements when they move offscreen and are recycled.


A protocol that defines a button that controls the collapse of a collection view’s section.


Together with the NSColorPickingDefault protocol, NSColorPickingCustom provides a way to add color pickers—custom user interfaces for color selection—to an application’s NSColorPanel instance. The NSColorPickingDefault protocol provides basic behavior for a color picker. The NSColorPicker class adopts the NSColorPickingDefault protocol.


The NSColorPickingDefault protocol, together with the NSColorPickingCustom protocol, provides an interface for adding color pickers—custom user interfaces for color selection—to an application’s NSColorPanel instance. The NSColorPickingDefault protocol provides basic behavior for a color picker. The NSColorPickingCustom protocol provides implementation-specific behavior.


The NSComboBoxDelegate protocol defines the optional methods implemented by delegates of NSComboBox objects.


The NSControlTextEditingDelegate protocol defines the optional methods implemented by delegates of objects that are subclasses of NSControl.


The NSDatePickerCellDelegate protocol defines the optional methods implemented by delegates of NSDatePickerCell objects.


NSDictionaryControllerKeyValuePair is an informal protocol that is implemented by objects returned by the NSDictionaryController method arrangedObjects. See NSDictionaryController for more information.


The NSDockTilePlugIn protocol defines the methods implemented by plug-ins that allow an application’s Dock tile to be customized while the application is not running.


The NSDraggingDestination protocol declares methods that the destination object (or recipient) of a dragged image must implement. The destination automatically receives NSDraggingDestination messages for pasteboard data types it has registered for as an image enters, moves around inside, and then exits or is released within the destination’s boundaries.


The NSDraggingInfo protocol declares methods that supply information about a dragging session.


The NSDraggingSource protocol declares methods that are implemented by the source object in a dragging session.


The NSDrawerDelegate protocol defines the messages sent to delegates of NSDrawer. All of the methods of this protocol are optional.


The NSEditor informal protocol is implemented by controllers and user interface elements. It provides a means for requesting that the receiver commit or discard any pending edits.


The NSEditorRegistration informal protocol is implemented by controllers to provide an interface for a view, the editor, to inform the controller when it has uncommitted changes.


Informal protocol. The Font Panel can be explicitly ordered to display some or all of its elements by responding to the validModesForFontPanel(_:) instance method.


The NSGestureRecognizerDelegate protocol implements methods for fine-tuning a gesture recognizer’s behavior. Use these methods to establish dynamic dependencies between gesture recognizers and to prevent a single gesture recognizer from acting at all.


The NSGlyphStorage protocol defines the methods that a glyph storage object must implement in order to interact properly with NSGlyphGenerator.


The NSHapticFeedbackPerformer protocol defines the methods and constants that a haptic feedback performer implements.


Implement this protocol to have the Ignore button in the Spelling panel function properly. The Ignore button allows the user to accept a word that the spelling checker believes is misspelled. In order for this action to update the “ignored words” list for the document being checked, the NSIgnoreMisspelledWords protocol must be implemented.


The NSImageDelegate protocol defines the optional methods implemented by delegates of NSImage objects.


The NSKeyValueBindingCreation informal protocol provides methods to create and remove bindings between view objects and controllers or controllers and model objects. In addition, it provides a means for a view subclass to advertise the bindings that it exposes. This informal protocol is implemented by NSObject and its methods can be overridden by view and controller subclasses.


This protocol defines an optional CALayer delegate method for handling resolution changes, allowing you to manage scale and contents for a layer hosted in a view.


The NSLayoutManagerDelegate protocol defines the optional methods implemented by delegates of NSLayoutManager objects.


The NSMatrixDelegate protocol defines the optional methods implemented by delegates of NSMatrix objects.


The NSMenuDelegate protocol defines the optional methods implemented by delegates of NSMenu objects.


This informal protocol allows your application to update the enabled or disabled status of an NSMenuItem object. It declares only one method, validateMenuItem(_:).


The NSOpenSavePanelDelegate protocol defines the methods that a delegate of NSOpenPanel or NSSavePanel should implement.


The NSOutlineViewDelegate protocol defines the optional methods implemented by delegates of NSOutlineView objects.


The NSPageControllerDelegate protocol allows you to customize the behavior of instances of the NSPageController class.


This protocol is implemented by the data provider of a pasteboard item to provide the data for a particular UTI type.


The NSPasteboardReading protocol specifies the interface for initializing an object from a pasteboard.


The NSPasteboardWriting protocol specifies the interface for retrieving a representation of an object that can be written to a pasteboard. The Cocoa framework classes NSString, NSAttributedString, NSURL, NSColor, NSSound, NSImage, and NSPasteboardItem implement this protocol. You can make your custom class conform to this protocol so that you can write instances of the class to a pasteboard using the writeObjects(_:) method of NSPasteboard.


The NSPathCellDelegate optional protocol enables the delegate of an NSPathCell object to customize the Open panel or pop-up menu of a path whose style is set to popUp.


The NSPathControlDelegate optional protocol is implemented by the delegate of an NSPathControl object to support dragging to and from the control.


The NSPlaceholders protocol provides an interface that allows an object to register default placeholders that will be displayed for a binding, when no other placeholder has been specified. Individual placeholder values can be specified for each of the marker objects (described in Selection Markers), as well as when the property is nil.


The NSPopoverDelegate protocol defines optional methods that can be implemented by an NSPopover delegate class to provide additional or custom functionality.


The NSPrintPanelAccessorizing protocol declares two methods that the NSPrintPanel class uses to get information from a printing accessory controller.


The NSRuleEditorDelegate protocol defines the optional methods implemented by delegates of NSRuleEditor objects.


Implement the methods in the segue performing protocol to mediate a custom segue.


This informal protocol consists of two methods, writeSelectionToPasteboard:types: and readSelectionFromPasteboard:. The first method provides data to a remote service, and the second receives any data the remote service might send back. Both respond to messages that are generated when the user chooses a command from the Services menu.


The NSSharingServiceDelegate protocol allows customization of the position and animation of the share sheet as well as be notified of the success or failure of the item being shared..


The NSSharingServicePickerDelegate protocol allows customization of the service picker behavior.


The NSSoundDelegate protocol defines the optional methods implemented by delegates of NSSound objects.


The NSSpeechRecognizerDelegate protocol defines the optional methods implemented by delegates of NSSpeechRecognizer objects.


The NSSpeechSynthesizerDelegate protocol defines the optional methods implemented by delegates of NSSpeechSynthesizer objects.


The NSSplitViewDelegate protocol defines the optional methods implemented by delegates of NSSplitView objects.


The NSSpringLoadingDestination protocol declares methods that the destination object (or recipient) of a dragged object can implement to support spring-loading—the act of dragging an object onto a destination object and hovering or force clicking to activate the destination object.


To configure a custom class to respond to a view detaching from, or reattaching to, a stack view (an instance of the NSStackView class), configure the custom class to adopt the NSStackViewDelegate protocol. Then, in a stack view instance, set the delegate property to refer to an instance of your custom class.


The NSTableViewDataSource protocol declares the methods that an instance of NSTableView uses to provide the data to a table view and allow editing of the contents of its data source object.


The NSTableViewDelegate protocol defines the optional methods implemented by delegates of NSTableView objects. Using a table view delegate allows you to customize a table view’s behavior without creating a table view subclass. A table view delegate provides views for table rows and columns, and supports functionality such as column reordering and resizing and row selection.


The NSTabViewDelegate protocol defines the optional methods implemented by delegates of NSTabView objects.


The NSTextAttachmentCell protocol declares the interface for objects that draw text attachment icons and handle mouse events on their icons. With the exceptions of cellBaselineOffset(), attachment, and attachment, all of these methods are implemented by the NSCell class and described in that class specification.


The NSTextAttachmentContainer protocol defines the interface to text attachment objects from NSLayoutManager.


The NSTextDelegate protocol defines the optional methods implemented by delegates of NSText objects.


The NSTextFieldDelegate protocol adopts the NSControlTextEditingDelegate protocol and currently does not extend it further.


The NSTextFindBarContainer protocol provides a container in which the find bar is displayed.


The NSTextFinderClient protocol is implemented by objects that wish to support searching using the NSTextFinder class and the in-window text finder bar.


The NSTextInput protocol defines the methods that Cocoa text views must implement in order to interact properly with the text input management system.


The NSTextInputClient protocol defines the methods that Cocoa text views must implement in order to interact properly with the text input management system. To create another text view class, you can either subclass NSTextView (and not NSText, for historical reasons), or subclass NSView and implement the NSTextInputClient protocol


The NSTextLayoutOrientationProvider protocol defines the orientation of text for an object. In macOS, the NSTextContainer and NSTextView classes adopt this protocol; in iOS, only the NSTextContainer class implements it. A NSTextContainer object returns the value from its associated text view when present; otherwise, it returns horizontal by default. If you define a custom NSTextContainer object, you can override this method and return vertical to support laying out text vertically.


The NSTextStorageDelegate protocol defines the optional methods implemented by delegates of NSTextStorage objects.


The NSTextViewDelegate protocol defines the optional methods implemented by delegates of NSTextView objects.


The NSTokenFieldCellDelegate protocol defines the optional methods implemented by delegates of NSTokenFieldCell objects.


The NSTokenFieldDelegate protocol defines the optional methods implemented by delegates of NSTokenField objects.


The NSToolbarDelegate protocol defines the optional methods implemented by delegates of NSToolbar objects.


A toolbar item with a valid target and action is enabled by default. To allow a toolbar item to be disabled in certain situations, a toolbar item’s target can implement the validateToolbarItem(_:) method.


The NSToolTipOwner informal protocol declares a method that allows an object to dynamically provide the text to a tool tip. If the tool tip object does not implement this method, the NSObject protocol description method is invoked instead.


The NSUserInterfaceItemIdentification protocol is used to associate a unique identifier with objects in your user interface. The protocol is adopted by AppKit interface objects to support window restoration, whereby information about window and other interface-related objects is preserved and used to restore the application’s interface during the next launch cycle.


The NSUserInterfaceItemSearching protocol show an application can implement Spotlight for Help for their own custom help data.


The NSUserInterfaceValidations protocol works with the NSValidatedUserInterfaceItem protocol to allow the target of a user interface element such as a menu item or a toolbar item to decide whether or not the user interface element should be enabled.


The NSValidatedUserInterfaceItem protocol works with the NSUserInterfaceValidations protocol to enable or disable a control automatically, depending on whether any responder in the responder chain can handle the control’s action method. The NSMenuItem and NSToolbarItem classes implement this protocol.


The view controller presentation animator protocol lets you define animations to play when transitioning between two view controllers.


The NSWindowDelegate protocol defines the methods that a delegate of NSWindow should implement. All methods in this protocol are optional.


The NSWindowRestoration protocol defines the method that restoration classes must implement to handle the recreation of windows. At launch time, the application object retrieves the restoration class and uses its restoreWindow(withIdentifier:state:completionHandler:) method to obtain a new window whose type matches the type that was preserved previously. Classes that adopt this protocol can use the provided information to create (or obtain a reference to) the window in the new application. As part of creating the window, the class should also create any related objects, such as window controllers, normally used to manage the window.


Category on NSWindow. Supports window scripting for all scriptable Cocoa applications by getting and setting standard properties and handling the close, print, and save AppleScript commands.


NSAppleScript AppKit Additions

The Application Kit adds a method to the Foundation framework’s NSAppleScript class to handle rich text source. This method becomes part of the NSAppleScript class only for those applications that use the Application Kit.

AppKit Functions

This document describes functions and function-like macros defined in the Application Kit framework.

AppKit Data Types

This document describes the data types defined in the Application Kit framework and not described in a document for an individual class.

AppKit ConstantsAppKit Enumerations



This constant indicates whether at least part of any window owned by this app is visible.


Constants that control the presentation of the app, typically for fullscreen apps such as games or kiosks.


Constants used by the autoresizingMask property.


Constants representing the various bitmap component formats.


Constants used by the hitTest(for:in:of:) method to determine the effect of an event.


Constants for specifying what happens when a button is pressed or is displaying its alternate state.


Constants indicating the options for scrolling the collection view’s content.


Constants that specify the date and time elements displayed by the picker.


These constants are masks for the events defined in NSEventType. Pass them to the NSCell method sendAction(on:) to specify when an NSCell should send its action message.


These constants represent the possible phases during an event phase.


These constants specify they swipe tracking options.


These constants specify the visibility of font collections.


Mask of traits assigned to a font, assigned using the values in Font traits.


Specifies gradient drawing options.


A bit mask that specifies both a part of an interface element to align and a direction for the alignment between two interface elements.


These constants are masks used to configure a Media Library Browser to display specific types of media. Combined masks are not yet supported. In other words, only one nonzero mask value is supported at a time. If masks are combined, the lowest mask value is used.


These constants are used as a bitmask for specifying a set of menu or menu item properties, and are contained by the propertiesToUpdate property.


Constants used to configure the contents of a PDF panel.


Options to specify how data on the pasteboard should be interpreted to initialize an object in init(pasteboardPropertyList:ofType:).


Type to specify options for writing to a pasteboard.


These constants are used to configure the contents of the main Print panel.


These constants determine whether apps launched by remote notifications display a badge.


These constants denote the type of spring-loading behavior configured for the destination object.


The following constants are provided as rendering options for a string when it is drawn.


Specifies the animation effects to apply when inserting or removing rows.


NSTableView defines these constants to specify grid styles. These constants are used by the gridStyleMask property. The mask can be either gridNone or it can contain either or both of the other options combined using the C bitwise OR operator.


Constants indicating the types of changes that were made.


The possible phases of a touch. These constants are used by phase.


The data type defined for the constants specified in the options parameter of init(rect:options:owner:userInfo:). These constants are described below; you can specify multiple constants by performing a bitwise-OR operation with them. In particular, you must supply one or more of the tracking-type constants (that is, mouseEnteredAndExited, mouseMoved, and cursorUpdate) and one of the active constants (that is, activeWhenFirstResponder, activeInKeyWindow, activeInActiveApp, and activeAlways). In addition, you may specify any of the behavior constants (that is, assumeInside, inVisibleRect, and enabledDuringMouseDrag).


The following constants are possible values returned by the actionForControlCharacter(at:) method to determine the action associated with a control character.


Animation options for view transitions in a view controller.


Window collection behaviors related to Exposé and Spaces.


This constant indicates a window ordering.


Specifies whether the window is occluded.


These constants specify the style of a window, and can be combined using the C bitwise OR operator.


These constants describe the NSWorkspaceIconCreationOptions values used by setIcon(_:forFile:options:). You can combine these using the C bitwise OR operator.

Extended Types


The component values defining a color in a specific color space.


A representation of an image to be processed or produced by Core Image filters.


Describes errors within the Cocoa error domain.


The error code itself.


IndexPath represents the path to a specific node in a tree of nested array collections.


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


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


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


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.


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.


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.


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.


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.


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


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 extensively throughout Foundation and other Cocoa frameworks, serving as the basis for all textual and linguistic functionality on the platform.


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.


URLs to file system resources support the properties defined below. Note that not all property values will exist for all file system URLs. For example, if a file is located on a volume that does not support creation dates, it is valid to request the creation date property, but the returned value will be nil, and no error will be generated.