Mac Developer Library

Developer

AppKit Framework Reference NSUserInterfaceValidations Protocol Reference

Options
Deployment Target:

On This Page
Language:

NSUserInterfaceValidations

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import AppKit

Objective-C

@import AppKit;

Availability


Available in OS X v10.0 and later.

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.

Your custom classes should adopt this protocol if an instance may be the target of a user interface element and need to conditionally enable or disable the element based on the current state of the instance. For more details, read User Interface Validation.

  • Returns a Boolean value that indicates whether the sender should be enabled. (required)

    Declaration

    Swift

    func validateUserInterfaceItem(_ anItem: NSValidatedUserInterfaceItem) -> Bool

    Objective-C

    - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)anItem

    Parameters

    anItem

    The user interface item to validate. You can send anItem the action and tag messages.

    Return Value

    YEStrue if the user interface item should be enabled, otherwise NOfalse.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.