Mac Developer Library

Developer

AppKit Framework Reference NSUserInterfaceItemIdentification Protocol Reference

Options
Deployment Target:

On This Page
Language:

NSUserInterfaceItemIdentification

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import AppKit

Objective-C

@import AppKit;

Availability


Available in OS X v10.7 and later.

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.

  • identifier identifier Required Property

    A string that identifies the user interface item. (required)

    Declaration

    Swift

    var identifier: String? { get set }

    Objective-C

    @property(copy) NSString *identifier

    Discussion

    Identifiers are used during window restoration operations to uniquely identify the windows of the application. You can set the value of this string programmatically or in Interface Builder. If you create an item in Interface Builder and do not set a value for this string, a unique value is created for the item when the nib file is loaded. For programmatically created views, you typically set this value after creating the item but before adding it to a window.

    You should not change the value of a window’s identifier after adding any views to the window. For views and controls in a window, the value you specify for this string must be unique on a per-window basis.

    The slash (/), backslash (\), or colon (:) characters are reserved and must not be used in your custom identifiers. Similarly, Apple reserves all identifiers beginning with an underscore (_) character. Applications and frameworks should use a consistent prefix for their identifiers to avoid collisions with other frameworks. For a list of prefixes used by the system frameworks, see OS X Frameworks in Mac Technology Overview.

    If you are subclassing a class from one of the system frameworks, do not override the accessor methods of this protocol.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.7 and later.