Mac Developer Library

Developer

AppKit Framework Reference NSResponder Class Reference

Options
Deployment Target:

On This Page
Language:

NSResponder

Conforms To


Import Statement


Swift

import AppKit

Objective-C

@import AppKit;

Availability


Available in OS X v10.0 and later.

NSResponder is an abstract class that forms the basis of event and command processing in the Application Kit. 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.

Starting with OS X v10.4, NSResponder plays an important role in the presentation of error information. The default implementations of the presentError: and presentError:modalForWindow:delegate:didPresentSelector:contextInfo: methods send willPresentError: to self, thereby giving subclasses the opportunity to customize the localized information presented in error alerts. NSResponder then forwards the message to the next responder, passing it the customized NSError object. The exact path up the modified responder chain depends on the type of application window:

  • Window owned by document: view ➞ superviews ➞ window ➞ window controller ➞ document object ➞ document controller ➞ the application object

  • Window with window controller but no documents: view ➞ superviews ➞ window ➞ window controller ➞ the application object

  • Window with no window controllers: view ➞ superviews ➞ window ➞ the application object

NSApplication displays a document-modal error alert and, if the error object has a recovery attempter, gives it a chance to recover from the error. (A recovery attempter is an object that conforms to the NSErrorRecoveryAttempting informal protocol.)

  • Whether the responder accepts first responder status.

    Declaration

    Swift

    var acceptsFirstResponder: Bool { get }

    Objective-C

    @property(readonly) BOOL acceptsFirstResponder

    Discussion

    As first responder, the receiver is the first object in the responder chain to be sent key events and action messages. By default, this property is NOfalse. Subclasses set this property to YEStrue if the receiver accepts first responder status.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Notifies the receiver that it’s about to become first responder in its NSWindow.

    Declaration

    Swift

    func becomeFirstResponder() -> Bool

    Objective-C

    - (BOOL)becomeFirstResponder

    Discussion

    The default implementation returns YEStrue, accepting first responder status. Subclasses can override this method to update state or perform some action such as highlighting the selection, or to return NOfalse, refusing first responder status.

    Use the NSWindow makeFirstResponder: method, not this method, to make an object the first responder. Never invoke this method directly.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Notifies the receiver that it’s been asked to relinquish its status as first responder in its window.

    Declaration

    Swift

    func resignFirstResponder() -> Bool

    Objective-C

    - (BOOL)resignFirstResponder

    Discussion

    The default implementation returns YEStrue, resigning first responder status. Subclasses can override this method to update state or perform some action such as unhighlighting the selection, or to return NOfalse, refusing to relinquish first responder status.

    Use the NSWindow makeFirstResponder: method, not this method, to make an object the first responder. Never invoke this method directly.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Allow controls to determine when they should become first responder.

    Declaration

    Swift

    func validateProposedFirstResponder(_ responder: NSResponder, forEvent event: NSEvent?) -> Bool

    Objective-C

    - (BOOL)validateProposedFirstResponder:(NSResponder *)responder forEvent:(NSEvent *)event

    Parameters

    responder

    The first responder.

    event

    The event to validate. May be nil if there is no applicable event.

    Return Value

    YEStrue if the control should become first responder, otherwise NOfalse.

    Discussion

    Some controls, such as NSTextField, should only become first responder when the enclosing NSTableView/NSBrowser indicates that the view can begin editing. It is up to the particular control that wants to be validated to call this method in its mouseDown: method (or perhaps at another time) to determine if it should attempt to become the first responder or not.

    The NSTableView, NSOutlineView, and NSBrowser classes implement this to allow first responder status only if the responder is a view in a selected row. It also delays the first responder assignment if a doubleAction may be invoked.

    The default implementation returns YEStrue when there is no nextResponder set, otherwise, it is forwarded up the responder chain.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • The next responder after this one, or nil if it has none.

    Declaration

    Swift

    unowned(unsafe) var nextResponder: NSResponder?

    Objective-C

    @property(assign) NSResponder *nextResponder

    Discussion

    The next responder must be an object that inherits, directly or indirectly, from NSResponder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Informs the receiver that the user has pressed the left mouse button.

    Declaration

    Swift

    func mouseDown(_ theEvent: NSEvent)

    Objective-C

    - (void)mouseDown:(NSEvent *)theEvent

    Parameters

    theEvent

    An object encapsulating information about the mouse-down event.

    Discussion

    The default implementation simply passes this message to the next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Informs the receiver that the user has moved the mouse with the left button pressed.

    Declaration

    Swift

    func mouseDragged(_ theEvent: NSEvent)

    Objective-C

    - (void)mouseDragged:(NSEvent *)theEvent

    Parameters

    theEvent

    An object encapsulating information about the mouse-dragged event.

    Discussion

    The default implementation simply passes this message to the next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Informs the receiver that the user has released the left mouse button.

    Declaration

    Swift

    func mouseUp(_ theEvent: NSEvent)

    Objective-C

    - (void)mouseUp:(NSEvent *)theEvent

    Parameters

    theEvent

    An object encapsulating information about the mouse-up event.

    Discussion

    The default implementation simply passes this message to the next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Informs the receiver that the mouse has moved.

    Declaration

    Swift

    func mouseMoved(_ theEvent: NSEvent)

    Objective-C

    - (void)mouseMoved:(NSEvent *)theEvent

    Parameters

    theEvent

    An object encapsulating information about the mouse-moved event.

    Discussion

    The default implementation simply passes this message to the next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    setAcceptsMouseMovedEvents: (NSWindow)

  • Informs the receiver that the cursor has entered a tracking rectangle.

    Declaration

    Swift

    func mouseEntered(_ theEvent: NSEvent)

    Objective-C

    - (void)mouseEntered:(NSEvent *)theEvent

    Parameters

    theEvent

    An object encapsulating information about the mouse-entered event.

    Discussion

    The default implementation simply passes this message to the next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Informs the receiver that the cursor has exited a tracking rectangle.

    Declaration

    Swift

    func mouseExited(_ theEvent: NSEvent)

    Objective-C

    - (void)mouseExited:(NSEvent *)theEvent

    Parameters

    theEvent

    An object encapsulating information about the mouse-exited event.

    Discussion

    The default implementation simply passes this message to the next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Informs the receiver that the user has pressed the right mouse button.

    Declaration

    Swift

    func rightMouseDown(_ theEvent: NSEvent)

    Objective-C

    - (void)rightMouseDown:(NSEvent *)theEvent

    Parameters

    theEvent

    An object encapsulating information about the mouse-down event.

    Discussion

    The default implementation simply passes this message to the next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – rightMouseDown: (NSView)

  • Informs the receiver that the user has moved the mouse with the right button pressed .

    Declaration

    Swift

    func rightMouseDragged(_ theEvent: NSEvent)

    Objective-C

    - (void)rightMouseDragged:(NSEvent *)theEvent

    Parameters

    theEvent

    An object encapsulating information about the mouse-dragged event.

    Discussion

    The default implementation simply passes this message to the next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Informs the receiver that the user has released the right mouse button.

    Declaration

    Swift

    func rightMouseUp(_ theEvent: NSEvent)

    Objective-C

    - (void)rightMouseUp:(NSEvent *)theEvent

    Parameters

    theEvent

    An object encapsulating information about the mouse-up event.

    Discussion

    The default implementation simply passes this message to the next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Informs the receiver that the user has pressed a mouse button other than the left or right one.

    Declaration

    Swift

    func otherMouseDown(_ theEvent: NSEvent)

    Objective-C

    - (void)otherMouseDown:(NSEvent *)theEvent

    Parameters

    theEvent

    An object encapsulating information about the mouse-down event.

    Discussion

    The default implementation simply passes this message to the next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.1 and later.

  • Informs the receiver that the user has moved the mouse with a button other than the left or right button pressed.

    Declaration

    Swift

    func otherMouseDragged(_ theEvent: NSEvent)

    Objective-C

    - (void)otherMouseDragged:(NSEvent *)theEvent

    Parameters

    theEvent

    An object encapsulating information about the mouse-dragged event.

    Discussion

    The default implementation simply passes this message to the next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.1 and later.

  • Informs the receiver that the user has released a mouse button other than the left or right button.

    Declaration

    Swift

    func otherMouseUp(_ theEvent: NSEvent)

    Objective-C

    - (void)otherMouseUp:(NSEvent *)theEvent

    Parameters

    theEvent

    An object encapsulating information about the mouse-up event.

    Discussion

    The default implementation simply passes this message to the next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.1 and later.

  • Informs the receiver that the user has pressed a key.

    Declaration

    Swift

    func keyDown(_ theEvent: NSEvent)

    Objective-C

    - (void)keyDown:(NSEvent *)theEvent

    Parameters

    theEvent

    An object encapsulating information about the key-down event.

    Discussion

    The receiver can interpret theEvent itself, or pass it to the system input manager using interpretKeyEvents:. The default implementation simply passes this message to the next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Informs the receiver that the user has released a key.

    Declaration

    Swift

    func keyUp(_ theEvent: NSEvent)

    Objective-C

    - (void)keyUp:(NSEvent *)theEvent

    Parameters

    theEvent

    An object encapsulating information about the key-up event.

    Discussion

    The default implementation simply passes this message to the next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Invoked by subclasses from their keyDown: method to handle a series of key events.

    Declaration

    Swift

    func interpretKeyEvents(_ eventArray: [AnyObject])

    Objective-C

    - (void)interpretKeyEvents:(NSArray *)eventArray

    Parameters

    eventArray

    An array of key-event characters to give to the system input manager.

    Discussion

    This method sends the character input in eventArray to the system input manager for interpretation as text to insert or commands to perform. The input manager responds to the request by sending insertText: and doCommandBySelector: messages back to the invoker of this method. Subclasses shouldn’t override this method.

    See the NSInputManager and NSTextInput class and protocol specifications for more information on input management.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Overridden by subclasses to handle a key equivalent.

    Declaration

    Swift

    func performKeyEquivalent(_ theEvent: NSEvent) -> Bool

    Objective-C

    - (BOOL)performKeyEquivalent:(NSEvent *)theEvent

    Parameters

    theEvent

    An event object that represents the key equivalent pressed.

    Discussion

    If the character code or codes in theEvent match the receiver’s key equivalent, the receiver should respond to the event and return YEStrue. The default implementation does nothing and returns NOfalse.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    performKeyEquivalent: (NSView)
    performKeyEquivalent: (NSButton)

  • Overridden by subclasses to handle a mnemonic.

    Declaration

    Objective-C

    - (BOOL)performMnemonic:(NSString *)aString

    Parameters

    aString

    A string containing mnemonic character code or codes.

    Discussion

    If the character code or codes in aString match the receiver’s mnemonic, the receiver should perform the mnemonic and return YEStrue. The default implementation does nothing and returns NOfalse. Mnemonics are not supported in OS X.

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Available in OS X v10.0 and later.

    Deprecated in OS X v10.8.

    See Also

    performMnemonic: (NSView)

  • Overridden by subclasses to clear any unprocessed key events.

    Declaration

    Swift

    func flushBufferedKeyEvents()

    Objective-C

    - (void)flushBufferedKeyEvents

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Invoked when a pressure change occurs as the result of a user input event on a system that supports pressure sensitivity.

    Declaration

    Swift

    func pressureChangeWithEvent(_ event: NSEvent!)

    Objective-C

    - (void)pressureChangeWithEvent:(NSEvent *)event

    Parameters

    event

    An NSEvent object encapsulating information about the event that invoked the change in pressure.

    Discussion

    This method is invoked automatically in response to user actions. event is the event that initiated the change in pressure.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.10.3 and later.

    See Also

    NSEvent

  • Informs the receiver that the mouse cursor has moved into a cursor rectangle.

    Declaration

    Swift

    func cursorUpdate(_ event: NSEvent)

    Objective-C

    - (void)cursorUpdate:(NSEvent *)event

    Parameters

    event

    An object encapsulating information about the cursor-update event (NSCursorUpdate).

    Discussion

    Override this method to set the cursor image. The default implementation uses cursor rectangles, if cursor rectangles are currently valid.  If they are not, it calls super to send the message up the responder chain.

    If the responder implements this method, but decides not to handle a particular event, it should invoke the superclass implementation of this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Informs the receiver that the user has pressed or released a modifier key (Shift, Control, and so on).

    Declaration

    Swift

    func flagsChanged(_ theEvent: NSEvent)

    Objective-C

    - (void)flagsChanged:(NSEvent *)theEvent

    Parameters

    theEvent

    An object encapsulating information about the modifier-key event.

    Discussion

    The default implementation simply passes this message to the next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Informs the receiver that a tablet-point event has occurred.

    Declaration

    Swift

    func tabletPoint(_ theEvent: NSEvent)

    Objective-C

    - (void)tabletPoint:(NSEvent *)theEvent

    Parameters

    theEvent

    An object encapsulating information about the tablet-point event.

    Discussion

    Tablet events are represented by NSEvent objects of type NSTabletPoint. They describe the current state of a transducer (that is, a pointing device) that is in proximity to its tablet, reflecting changes such as location, pressure, tilt, and rotation. See the NSEvent reference for the methods that allow you to extract this and other information from theEvent. The default implementation of NSResponder passes the message to the next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.4 or later.

  • Informs the receiver that a tablet-proximity event has occurred.

    Declaration

    Swift

    func tabletProximity(_ theEvent: NSEvent)

    Objective-C

    - (void)tabletProximity:(NSEvent *)theEvent

    Parameters

    theEvent

    An object encapsulating information about the tablet-point event.

    Discussion

    Tablet events are represented by NSEvent objects of type NSTabletProximity. Tablet devices generate proximity events when the transducer (pointing device) nears a tablet and when it moves away from a tablet. From an event object of this type you can extract information about the kind of device and its capabilities, as well as the relation of this tablet-proximity event to various tablet-point events; see the NSEvent reference for details. The default implementation passes the message to the next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.4 or later.

  • Displays context-sensitive help for the receiver if such exists; otherwise passes this message to the next responder.

    Declaration

    Swift

    func helpRequested(_ theEvent: NSEvent)

    Objective-C

    - (void)helpRequested:(NSEvent *)theEvent

    Parameters

    theEvent

    An object encapsulating information about the help-request event.

    Discussion

    NSWindow invokes this method automatically when the user clicks for help—while processing theEvent. Subclasses need not override this method, and application code shouldn’t directly invoke it.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Informs the receiver that the mouse’s scroll wheel has moved.

    Declaration

    Swift

    func scrollWheel(_ theEvent: NSEvent)

    Objective-C

    - (void)scrollWheel:(NSEvent *)theEvent

    Parameters

    theEvent

    An object encapsulating information about the wheel-scrolling event.

    Discussion

    The default implementation simply passes this message to the next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to perform a Quick Look on the content at location in the event.

    Declaration

    Swift

    func quickLookWithEvent(_ event: NSEvent)

    Objective-C

    - (void)quickLookWithEvent:(NSEvent *)event

    Parameters

    event

    An event object containing the location of the Quick Look content.

    Discussion

    If there are no Quick Look items at the location, call super.

    The NSEventTypeQuickLook event type supports this method. The only valid properties of an NSEventTypeQuickLook event are locationInWindow and modifierFlags. A Quick Look event does not come in through the normal event mechanism, therefore there is no corresponding event mask for it, nor should you attempt to look for it in a sendEvent: message or with the nextEventMatchingMask: methods.

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.8 and later.

  • Implemented by subclasses to cancel the current operation.

    Declaration

    Swift

    func cancelOperation(_ sender: AnyObject?)

    Objective-C

    - (void)cancelOperation:(id)sender

    Parameters

    sender

    The object invoking this method.

    Discussion

    This method is bound to the Escape and Command-. (period) keys. The key window first searches the view hierarchy for a view whose key equivalent is Escape or Command-., whichever was entered. If none of these views handles the key equivalent, the window sends a default action message of cancelOperation: to the first responder and from there the message travels up the responder chain.

    If no responder in the responder chain implements cancelOperation:, the key window searches the view hierarchy for a view whose key equivalent is Escape (note that this may be redundant if the original key equivalent was Escape). If no such responder is found, then a cancel: action message is sent to the first responder in the responder chain that implements it.

    NSResponder declares but does not implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Implemented by subclasses to capitalize the word or words surrounding the insertion point or selection, expanding the selection if necessary.

    Declaration

    Swift

    func capitalizeWord(_ sender: AnyObject?)

    Objective-C

    - (void)capitalizeWord:(id)sender

    Parameters

    sender

    The object invoking the method.

    Discussion

    If either end of the selection partially covers a word, that entire word is made lowercase. The sender argument is typically the object that invoked this method. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to scroll the selection, whatever it is, inside its visible area.

    Declaration

    Swift

    func centerSelectionInVisibleArea(_ sender: AnyObject?)

    Objective-C

    - (void)centerSelectionInVisibleArea:(id)sender

    Parameters

    sender

    The object that invoked the method (typically).

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to change the case of a letter or letters in the selection, perhaps by opening a panel with capitalization options or by cycling through possible case combinations.

    Declaration

    Swift

    func changeCaseOfLetter(_ sender: AnyObject?)

    Objective-C

    - (void)changeCaseOfLetter:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to complete an operation in progress or a partially constructed element.

    Declaration

    Swift

    func complete(_ sender: AnyObject?)

    Objective-C

    - (void)complete:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    This method can be interpreted, for example, as a request to attempt expansion of a partial word, such as for expanding a glossary shortcut, or to close a graphics item being drawn. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to delete the selection, if there is one, or a single element backward from the insertion point (a letter or character in text, for example).

    Declaration

    Swift

    func deleteBackward(_ sender: AnyObject?)

    Objective-C

    - (void)deleteBackward:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to delete the selection, if there is one, or a single character backward from the insertion point.

    Declaration

    Swift

    func deleteBackwardByDecomposingPreviousCharacter(_ sender: AnyObject?)

    Objective-C

    - (void)deleteBackwardByDecomposingPreviousCharacter:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If the previous character is canonically decomposable, this method should try to delete only the last character in the grapheme cluster (for example, deleting “a”+ “´” results in “a”). NSResponder declares but does not implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Implemented by subclasses to delete the selection, if there is one, or a single element forward from the insertion point (a letter or character in text, for example).

    Declaration

    Swift

    func deleteForward(_ sender: AnyObject?)

    Objective-C

    - (void)deleteForward:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to delete the selection, if there is one, or all text from the insertion point to the beginning of a line (typically of text).

    Declaration

    Swift

    func deleteToBeginningOfLine(_ sender: AnyObject?)

    Objective-C

    - (void)deleteToBeginningOfLine:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    Also places the deleted text into the kill buffer. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – yank:

  • Implemented by subclasses to delete the selection, if there is one, or all text from the insertion point to the beginning of a paragraph of text.

    Declaration

    Swift

    func deleteToBeginningOfParagraph(_ sender: AnyObject?)

    Objective-C

    - (void)deleteToBeginningOfParagraph:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    Also places the deleted text into the kill buffer. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – yank:

  • Implemented by subclasses to delete the selection, if there is one, or all text from the insertion point to the end of a line (typically of text).

    Declaration

    Swift

    func deleteToEndOfLine(_ sender: AnyObject?)

    Objective-C

    - (void)deleteToEndOfLine:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    Also places the deleted text into the kill buffer. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to delete the selection, if there is one, or all text from the insertion point to the end of a paragraph of text.

    Declaration

    Swift

    func deleteToEndOfParagraph(_ sender: AnyObject?)

    Objective-C

    - (void)deleteToEndOfParagraph:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    Also places the deleted text into the kill buffer. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – yank:

  • Implemented by subclasses to delete the selection, if there is one, or all items from the insertion point to a previously placed mark, including the selection itself if not empty.

    Declaration

    Swift

    func deleteToMark(_ sender: AnyObject?)

    Objective-C

    - (void)deleteToMark:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    Also places the deleted text into the kill buffer. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to delete the selection, if there is one, or a single word backward from the insertion point.

    Declaration

    Swift

    func deleteWordBackward(_ sender: AnyObject?)

    Objective-C

    - (void)deleteWordBackward:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to delete the selection, if there is one, or a single word forward from the insertion point.

    Declaration

    Swift

    func deleteWordForward(_ sender: AnyObject?)

    Objective-C

    - (void)deleteWordForward:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to indent the selection or the insertion point if there is no selection.

    Declaration

    Swift

    func indent(_ sender: AnyObject?)

    Objective-C

    - (void)indent:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to handle a backward tab.

    Declaration

    Swift

    func insertBacktab(_ sender: AnyObject?)

    Objective-C

    - (void)insertBacktab:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    A field editor might respond to this method by selecting the field before it, while a regular text object either doesn’t respond to or ignores such a message. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to insert a container break (typically a page break) at the insertion point or selection, deleting the selection if there is one.

    Declaration

    Swift

    func insertContainerBreak(_ sender: AnyObject?)

    Objective-C

    - (void)insertContainerBreak:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method. NSTextView implements it to insert an NSFormFeedCharacter character (0x000c).

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Implemented by subclasses to insert a line break (as distinguished from a paragraph break) at the insertion point or selection, deleting the selection if there is one.

    Declaration

    Swift

    func insertLineBreak(_ sender: AnyObject?)

    Objective-C

    - (void)insertLineBreak:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method. NSTextView implements it to insert an NSLineSeparatorCharacter character (0x2028).

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Implemented by subclasses to insert a newline character at the insertion point or selection, deleting the selection if there is one, or to end editing if the receiver is a text field or other field editor.

    Declaration

    Swift

    func insertNewline(_ sender: AnyObject?)

    Objective-C

    - (void)insertNewline:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to insert a line-break character at the insertion point or selection, deleting the selection if there is one.

    Declaration

    Swift

    func insertNewlineIgnoringFieldEditor(_ sender: AnyObject?)

    Objective-C

    - (void)insertNewlineIgnoringFieldEditor:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    Unlike insertNewline:, this method always inserts a line-break character and doesn’t cause the receiver to end editing. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to insert a paragraph separator at the insertion point or selection, deleting the selection if there is one.

    Declaration

    Swift

    func insertParagraphSeparator(_ sender: AnyObject?)

    Objective-C

    - (void)insertParagraphSeparator:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to insert a tab character at the insertion point or selection, deleting the selection if there is one, or to end editing if the receiver is a text field or other field editor.

    Declaration

    Swift

    func insertTab(_ sender: AnyObject?)

    Objective-C

    - (void)insertTab:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to insert a tab character at the insertion point or selection, deleting the selection if there is one.

    Declaration

    Swift

    func insertTabIgnoringFieldEditor(_ sender: AnyObject?)

    Objective-C

    - (void)insertTabIgnoringFieldEditor:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    Unlike insertTab:, this method always inserts a tab character and doesn’t cause the receiver to end editing. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to insert a double quote character at the insertion point without interference by automatic quote correction.

    Declaration

    Swift

    func insertDoubleQuoteIgnoringSubstitution(_ sender: AnyObject?)

    Objective-C

    - (void)insertDoubleQuoteIgnoringSubstitution:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Implemented by subclasses to insert a single quote character at the insertion point without interference by automatic quote correction.

    Declaration

    Swift

    func insertSingleQuoteIgnoringSubstitution(_ sender: AnyObject?)

    Objective-C

    - (void)insertSingleQuoteIgnoringSubstitution:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Overridden by subclasses to insert the supplied string at the insertion point or selection, deleting the selection if there is one.

    Declaration

    Swift

    func insertText(_ aString: AnyObject)

    Objective-C

    - (void)insertText:(id)aString

    Parameters

    aString

    The string to insert or replace the selection with. aString can be either an NSString object or an NSAttributedString object.

    Discussion

    This method is often invoked by the system input manager after the receiver sends a interpretKeyEvents: message. The NSResponder implementation simply passes this message to the next responder, or beeps if there is no next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to make lowercase every letter in the word or words surrounding the insertion point or selection, expanding the selection if necessary.

    Declaration

    Swift

    func lowercaseWord(_ sender: AnyObject?)

    Objective-C

    - (void)lowercaseWord:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If either end of the selection partially covers a word, that entire word is made lowercase. NSResponder declares, but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to move the selection or insertion point one element or character backward.

    Declaration

    Swift

    func moveBackward(_ sender: AnyObject?)

    Objective-C

    - (void)moveBackward:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    In text, if there is a selection it should be deselected, and the insertion point should be placed at the beginning of the former selection. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to expand or reduce either end of the selection backward by one element or character.

    Declaration

    Swift

    func moveBackwardAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveBackwardAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If the end being modified is the backward end, this method expands the selection; if the end being modified is the forward end, it reduces the selection. The first moveBackwardAndModifySelection: or moveForwardAndModifySelection: method in a series determines the end being modified by always expanding. Hence, this method results in the backward end becoming the mobile one if invoked first. By default, moveLeftAndModifySelection: is bound to the left arrow key.

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to move the selection or insertion point to the beginning of the next paragraph, expanding or reducing the current selection.

    Declaration

    Swift

    func moveParagraphForwardAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveParagraphForwardAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If the cursor is already at the end of a paragraph, the selection moves forward to the end of the next paragraph.

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Implemented by subclasses to move the selection or insertion point to the beginning of the previous paragraph, expanding or reducing the current selection.

    Declaration

    Swift

    func moveParagraphBackwardAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveParagraphBackwardAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If the cursor is already at the beginning of a paragraph, the selection moves backward to the beginning of the previous paragraph.

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Implemented by subclasses to move the selection or insertion point to the beginning of the document, expanding or reducing the current selection.

    Declaration

    Swift

    func moveToBeginningOfDocumentAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveToBeginningOfDocumentAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Implemented by subclasses to move the selection or insertion point to the end of the document, expanding or reducing the current selection.

    Declaration

    Swift

    func moveToEndOfDocumentAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveToEndOfDocumentAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Implemented by subclasses to move the selection or insertion point to the beginning of the line, expanding or reducing the current selection.

    Declaration

    Swift

    func moveToBeginningOfLineAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveToBeginningOfLineAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Implemented by subclasses to move the selection or insertion point to the end of the line, expanding or reducing the current selection.

    Declaration

    Swift

    func moveToEndOfLineAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveToEndOfLineAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Implemented by subclasses to move the selection or insertion point to the beginning of the current paragraph, expanding or reducing the current selection.

    Declaration

    Swift

    func moveToBeginningOfParagraphAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveToBeginningOfParagraphAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Implemented by subclasses to move the selection or insertion point to the end of the current paragraph, expanding or reducing the current selection.

    Declaration

    Swift

    func moveToEndOfParagraphAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveToEndOfParagraphAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Implemented by subclasses to move the selection or insertion point to the left end of the line.

    Declaration

    Swift

    func moveToLeftEndOfLine(_ sender: AnyObject?)

    Objective-C

    - (void)moveToLeftEndOfLine:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    In text, if there is a selection it should be deselected, and the insertion point should be placed at left end of the line. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Implemented by subclasses to move the selection or insertion point to the left end of the line, expanding or contracting the selection as required.

    Declaration

    Swift

    func moveToLeftEndOfLineAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveToLeftEndOfLineAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Implemented by subclasses to move the selection or insertion point to the right end of the line

    Declaration

    Swift

    func moveToRightEndOfLine(_ sender: AnyObject?)

    Objective-C

    - (void)moveToRightEndOfLine:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Implemented by subclasses to move the selection or insertion point to the right end of the line, expanding or contracting the selection as required.

    Declaration

    Swift

    func moveToRightEndOfLineAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveToRightEndOfLineAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Implemented by subclasses to move the selection or insertion point one element or character down.

    Declaration

    Swift

    func moveDown(_ sender: AnyObject?)

    Objective-C

    - (void)moveDown:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    In text, if there is a selection it should be deselected, and the insertion point should be placed below the beginning of the former selection. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to expand or reduce the top or bottom end of the selection downward by one element, character, or line (whichever is appropriate for text direction).

    Declaration

    Swift

    func moveDownAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveDownAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If the end being modified is the bottom, this method expands the selection; if the end being modified is the top, it reduces the selection. The first moveDownAndModifySelection: or moveUpAndModifySelection: method in a series determines the end being modified by always expanding. Hence, this method results in the bottom end becoming the mobile one if invoked first.

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to move the selection or insertion point one element or character forward.

    Declaration

    Swift

    func moveForward(_ sender: AnyObject?)

    Objective-C

    - (void)moveForward:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    In text, if there is a selection it should be deselected, and the insertion point should be placed at the end of the former selection. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to expand or reduce either end of the selection forward by one element or character.

    Declaration

    Swift

    func moveForwardAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveForwardAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If the end being modified is the backward end, this method reduces the selection; if the end being modified is the forward end, it expands the selection. The first moveBackwardAndModifySelection: or moveForwardAndModifySelection: method in a series determines the end being modified by always expanding. Hence, this method results in the forward end becoming the mobile one if invoked first. By default, moveRightAndModifySelection: is bound to the right arrow key.

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to move the selection or insertion point one element or character to the left.

    Declaration

    Swift

    func moveLeft(_ sender: AnyObject?)

    Objective-C

    - (void)moveLeft:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    In text, if there is a selection it should be deselected, and the insertion point should be placed at the left end of the former selection. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to expand or reduce either end of the selection to the left (display order) by one element or character.

    Declaration

    Swift

    func moveLeftAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveLeftAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If the end being modified is the left end, this method expands the selection; if the end being modified is the right end, it reduces the selection. The first moveLeftAndModifySelection: or moveRightAndModifySelection: method in a series determines the end being modified by always expanding. Hence, this method results in the left end becoming the mobile one if invoked first. By default, this method is bound to the left arrow key.

    NSResponder declares but doesn’t implement this method.

    The essential difference between this method and the corresponding moveBackwardAndModifySelection: is that the latter method moves in logical order, which can differ in bidirectional text, whereas this method moves in display order.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Implemented by subclasses to move the selection or insertion point one element or character to the right.

    Declaration

    Swift

    func moveRight(_ sender: AnyObject?)

    Objective-C

    - (void)moveRight:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    In text, if there is a selection it should be deselected, and the insertion point should be placed at the right end of the former selection. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to expand or reduce either end of the selection to the right (display order) by one element or character.

    Declaration

    Swift

    func moveRightAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveRightAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If the end being modified is the left end, this method reduces the selection; if the end being modified is the right end, it expands the selection. The first moveLeftAndModifySelection: or moveRightAndModifySelection: method in a series determines the end being modified by always expanding. Hence, this method results in the right end becoming the mobile one if invoked first. By default, this method is bound to the right arrow key.

    NSResponder declares but doesn’t implement this method.

    The essential difference between this method and the corresponding moveForwardAndModifySelection: is that the latter method moves in logical order, which can differ in bidirectional text, whereas this method moves in display order.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Implemented by subclasses to move the selection to the first element of the document or the insertion point to the beginning.

    Declaration

    Swift

    func moveToBeginningOfDocument(_ sender: AnyObject?)

    Objective-C

    - (void)moveToBeginningOfDocument:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to move the selection to the first element of the selected line or the insertion point to the beginning of the line.

    Declaration

    Swift

    func moveToBeginningOfLine(_ sender: AnyObject?)

    Objective-C

    - (void)moveToBeginningOfLine:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to move the insertion point to the beginning of the selected paragraph.

    Declaration

    Swift

    func moveToBeginningOfParagraph(_ sender: AnyObject?)

    Objective-C

    - (void)moveToBeginningOfParagraph:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to move the selection to the last element of the document or the insertion point to the end.

    Declaration

    Swift

    func moveToEndOfDocument(_ sender: AnyObject?)

    Objective-C

    - (void)moveToEndOfDocument:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to move the selection to the last element of the selected line or the insertion point to the end of the line.

    Declaration

    Swift

    func moveToEndOfLine(_ sender: AnyObject?)

    Objective-C

    - (void)moveToEndOfLine:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to move the insertion point to the end of the selected paragraph.

    Declaration

    Swift

    func moveToEndOfParagraph(_ sender: AnyObject?)

    Objective-C

    - (void)moveToEndOfParagraph:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to move the selection or insertion point one element or character up.

    Declaration

    Swift

    func moveUp(_ sender: AnyObject?)

    Objective-C

    - (void)moveUp:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    In text, if there is a selection it should be deselected, and the insertion point should be placed above the beginning of the former selection. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to expand or reduce the top or bottom end of the selection upward by one element, character, or line (whichever is appropriate for text direction).

    Declaration

    Swift

    func moveUpAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveUpAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If the end being modified is the bottom, this method reduces the selection; if the end being modified is the top, it expands the selection. The first moveDownAndModifySelection: or moveUpAndModifySelection: method in a series determines the end being modified by always expanding. Hence, this method results in the top end becoming the mobile one if invoked first.

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to move the selection or insertion point one word backward.

    Declaration

    Swift

    func moveWordBackward(_ sender: AnyObject?)

    Objective-C

    - (void)moveWordBackward:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If there is a selection it should be deselected, and the insertion point should be placed at the end of the first word preceding the former selection. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to expand or reduce either end of the selection backward by one whole word.

    Declaration

    Swift

    func moveWordBackwardAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveWordBackwardAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If the end being modified is the backward end, this method expands the selection; if the end being modified is the forward end, it reduces the selection. The first moveWordBackwardAndModifySelection: or moveWordForwardAndModifySelection: method in a series determines the end being modified by always expanding. Hence, this method results in the backward end becoming the mobile one if invoked first.

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to move the selection or insertion point one word forward, in logical order.

    Declaration

    Swift

    func moveWordForward(_ sender: AnyObject?)

    Objective-C

    - (void)moveWordForward:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If there is a selection it should be deselected, and the insertion point should be placed at the beginning of the first word following the former selection. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to expand or reduce either end of the selection forward by one whole word.

    Declaration

    Swift

    func moveWordForwardAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveWordForwardAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If the end being modified is the backward end, this method reduces the selection; if the end being modified is the forward end, it expands the selection. The first moveWordBackwardAndModifySelection: or moveWordForwardAndModifySelection: method in a series determines the end being modified by always expanding. Hence, this method results in the forward end becoming the mobile one if invoked first. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to move the selection or insertion point one word to the left, in display order.

    Declaration

    Swift

    func moveWordLeft(_ sender: AnyObject?)

    Objective-C

    - (void)moveWordLeft:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If there is a selection it should be deselected, and the insertion point should be placed at the end of the first word to the left of the former selection. NSResponder declares but doesn’t implement this method.

    The main difference between this method and the corresponding moveWordBackward: method is that the latter moves in logical order, which is important in bidirectional text, whereas this method moves in display order.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Implemented by subclasses to move the selection or insertion point one word right.

    Declaration

    Swift

    func moveWordRight(_ sender: AnyObject?)

    Objective-C

    - (void)moveWordRight:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If there is a selection it should be deselected, and the insertion point should be placed at the beginning of the first word to the right of the former selection. NSResponder declares but doesn’t implement this method.

    The main difference between this method and the corresponding moveWordForward: method is that the latter moves in logical order, which is important in bidirectional text, whereas this method moves in display order.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Implemented by subclasses to expand or reduce either end of the selection to the right by one whole word.

    Declaration

    Swift

    func moveWordRightAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveWordRightAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If the end being modified is the backward end, this method reduces the selection; if the end being modified is the forward end, it expands the selection. The first moveWordBackwardAndModifySelection: or moveWordForwardAndModifySelection: method in a series determines the end being modified by always expanding. Hence, this method results in the forward end becoming the mobile one if invoked first. NSResponder declares but doesn’t implement this method.

    The main difference between this method and the corresponding moveWordForwardAndModifySelection: method is that the latter moves in logical order, which is important in bidirectional text, whereas this method moves in display order.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Implemented by subclasses to expand or reduce either end of the selection left by one whole word in display order.

    Declaration

    Swift

    func moveWordLeftAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)moveWordLeftAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If the end being modified is the left end, this method expands the selection; if the end being modified is the right end, it reduces the selection. The first moveWordLeftAndModifySelection: or moveWordRightAndModifySelection: method in a series determines the end being modified by always expanding. Hence, this method results in the left end becoming the mobile one if invoked first.

    NSResponder declares but doesn’t implement this method.

    The main difference between this method and the corresponding moveWordBackwardAndModifySelection: method is that the latter moves in logical order, which is important in bidirectional text, whereas this method moves in display order.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.3 and later.

  • Implemented by subclasses to scroll the receiver down (or back) one page in its scroll view, also moving the insertion point to the top of the newly displayed page.

    Declaration

    Swift

    func pageDown(_ sender: AnyObject?)

    Objective-C

    - (void)pageDown:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to scroll the receiver down (or back) one page in its scroll view, also moving the insertion point to the top of the newly displayed page. The selection is expanded or contracted as required.

    Declaration

    Swift

    func pageDownAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)pageDownAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Implemented by subclasses to scroll the receiver up (or forward) one page in its scroll view, also moving the insertion point to the top of the newly displayed page.

    Declaration

    Swift

    func pageUp(_ sender: AnyObject?)

    Objective-C

    - (void)pageUp:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to scroll the receiver up (or forward) one page in its scroll view, also moving the insertion point to the top of the newly displayed page. The selection is expanded or contracted as necessary.

    Declaration

    Swift

    func pageUpAndModifySelection(_ sender: AnyObject?)

    Objective-C

    - (void)pageUpAndModifySelection:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Implemented by subclasses to perform a Quick Look on the text cursor position, selection, or whatever is appropriate for your view.

    Declaration

    Swift

    func quickLookPreviewItems(_ sender: AnyObject?)

    Objective-C

    - (void)quickLookPreviewItems:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If there are no Quick Look items, then send nextResponder a tryToPerform:with: message to pass the request up the responder chain. Eventually AppKit will attempt to perform a dictionary look up.

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.8 and later.

  • Implemented by subclasses to scroll the receiver to the beginning of the document, without changing the selection.

    Declaration

    Swift

    func scrollToBeginningOfDocument(_ sender: AnyObject?)

    Objective-C

    - (void)scrollToBeginningOfDocument:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Implemented by subclasses to scroll the receiver to the end of the document, without changing the selection.

    Declaration

    Swift

    func scrollToEndOfDocument(_ sender: AnyObject?)

    Objective-C

    - (void)scrollToEndOfDocument:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Implemented by subclasses to scroll the receiver one line up in its scroll view, without changing the selection.

    Declaration

    Swift

    func scrollLineUp(_ sender: AnyObject?)

    Objective-C

    - (void)scrollLineUp:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – scrollLineDown:
    lineScroll (NSScrollView)

  • Implemented by subclasses to scroll the receiver one line down in its scroll view, without changing the selection.

    Declaration

    Swift

    func scrollLineDown(_ sender: AnyObject?)

    Objective-C

    - (void)scrollLineDown:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – scrollLineUp:
    lineScroll (NSScrollView)

  • Implemented by subclasses to scroll the receiver one page up in its scroll view, without changing the selection.

    Declaration

    Swift

    func scrollPageUp(_ sender: AnyObject?)

    Objective-C

    - (void)scrollPageUp:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – pageDown:
    – pageUp:
    pageScroll (NSScrollView)

  • Implemented by subclasses to scroll the receiver one page down in its scroll view, without changing the selection.

    Declaration

    Swift

    func scrollPageDown(_ sender: AnyObject?)

    Objective-C

    - (void)scrollPageDown:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – pageDown:
    – pageUp:
    pageScroll (NSScrollView)

  • Implemented by subclasses to select all selectable elements.

    Declaration

    Swift

    func selectAll(_ sender: AnyObject?)

    Objective-C

    - (void)selectAll:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to select all elements in the line or lines containing the selection or insertion point.

    Declaration

    Swift

    func selectLine(_ sender: AnyObject?)

    Objective-C

    - (void)selectLine:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to select all paragraphs containing the selection or insertion point.

    Declaration

    Swift

    func selectParagraph(_ sender: AnyObject?)

    Objective-C

    - (void)selectParagraph:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to select all items from the insertion point or selection to a previously placed mark, including the selection itself if not empty.

    Declaration

    Swift

    func selectToMark(_ sender: AnyObject?)

    Objective-C

    - (void)selectToMark:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to extend the selection to the nearest word boundaries outside it (up to, but not including, word delimiters).

    Declaration

    Swift

    func selectWord(_ sender: AnyObject?)

    Objective-C

    - (void)selectWord:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to set a mark at the insertion point or selection, which is used by deleteToMark: and selectToMark:.

    Declaration

    Swift

    func setMark(_ sender: AnyObject?)

    Objective-C

    - (void)setMark:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to invoke the help system, displaying information relevant to the receiver and its current state.

    Declaration

    Swift

    func showContextHelp(_ sender: AnyObject?)

    Objective-C

    - (void)showContextHelp:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Swaps the mark and the selection or insertion point, so that what was marked is now the selection or insertion point, and what was the insertion point or selection is now the mark.

    Declaration

    Swift

    func swapWithMark(_ sender: AnyObject?)

    Objective-C

    - (void)swapWithMark:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    – setMark:

  • Transposes the characters to either side of the insertion point and advances the insertion point past both of them. Does nothing to a selected range of text.

    Declaration

    Swift

    func transpose(_ sender: AnyObject?)

    Objective-C

    - (void)transpose:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Transposes the words to either side of the insertion point and advances the insertion point past both of them. Does nothing to a selected range of text.

    Declaration

    Swift

    func transposeWords(_ sender: AnyObject?)

    Objective-C

    - (void)transposeWords:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Implemented by subclasses to make uppercase every letter in the word or words surrounding the insertion point or selection, expanding the selection if necessary.

    Declaration

    Swift

    func uppercaseWord(_ sender: AnyObject?)

    Objective-C

    - (void)uppercaseWord:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If either end of the selection partially covers a word, that entire word is made uppercase. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Replaces the insertion point or selection with text from the kill buffer.

    Declaration

    Swift

    func yank(_ sender: AnyObject?)

    Objective-C

    - (void)yank:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    If invoked sequentially, cycles through the kill buffer in reverse order. See Standard Action Methods for Selecting and Editing in Cocoa Event Handling Guide for more information on the kill buffer. NSResponder declares but doesn’t implement this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • This method is used in the process of finding a target for an action method.

    Declaration

    Swift

    func supplementalTargetForAction(_ action: Selector, sender sender: AnyObject?) -> AnyObject?

    Objective-C

    - (id)supplementalTargetForAction:(SEL)action sender:(id)sender

    Parameters

    action

    The requested action.

    sender

    The message sender.

    Return Value

    An object which responds to the action, or nil.

    Discussion

    If this NSResponder instance does not itself respondsToSelector:, then supplementalTargetForAction:sender: is called.

    This method should return an object which responds to the action; if this responder does not have a supplemental object that does that, the implementation of this method should call super's supplementalTargetForAction:sender:.

    NSResponder's implementation returns nil.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • Saves the interface-related state of the responder.

    Declaration

    Swift

    func encodeRestorableStateWithCoder(_ coder: NSCoder)

    Objective-C

    - (void)encodeRestorableStateWithCoder:(NSCoder *)coder

    Parameters

    coder

    The coder object in which to save the responder’s interface-related state.

    Discussion

    This method is part of the window restoration system and is called at appropriate times to save the visual state of your responder to the specified archive. The default implementation of this method does nothing but specific subclasses (such as NSView and NSWindow) override it to save important state information. Therefore, if you override this method, you should always call super at some point in your implementation.

    Subclasses can override this method and use it to restore any information that would be needed to restore the responder to its current state. For example, the NSTabView class uses this method to save information about the currently selected tab. You must store enough data to reconfigure the responder and return it to its current state during a subsequent launch of the application.

    For information about using a coder object to write data to an archive, see Archives and Serializations Programming Guide.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • Restores the interface-related state of the responder.

    Declaration

    Swift

    func restoreStateWithCoder(_ coder: NSCoder)

    Objective-C

    - (void)restoreStateWithCoder:(NSCoder *)coder

    Parameters

    coder

    The coder object to use to restore the responder’s interface-related state.

    Discussion

    This method is part of the window restoration system and is called at launch time to restore the visual state of your responder object. The default implementation does nothing but specific subclasses (such as NSView and NSWindow) override it and save important state information. Therefore, if you override this method, you should always call super at some point in your implementation.

    Subclasses can override this method and use it to restore any information that was saved in the encodeRestorableStateWithCoder: method. You can also use this method to reconfigure the responder to its previous appearance.

    For information about using a coder object to read data from an archive, see Archives and Serializations Programming Guide.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • Returns an array of key paths representing the restorable attributes of the responder.

    Declaration

    Swift

    class func restorableStateKeyPaths() -> [AnyObject]

    Objective-C

    + (NSArray *)restorableStateKeyPaths

    Return Value

    An array of NSString objects, each of which contains a key path to one of the responder’s attributes.

    Discussion

    You can use this method instead of, or in addition to, the encodeRestorableStateWithCoder: and restoreStateWithCoder: methods to save and restore the state of your responder. The key paths you return must refer to attributes that are key-value coding and key-value observing compliant.

    When changes are detected, the specified attributes are automatically written to disk with the rest of the application’s interface-related state. At launch time, the attributes are automatically restored to their previous values.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • Marks the responder’s interface-related state as dirty.

    Declaration

    Swift

    func invalidateRestorableState()

    Objective-C

    - (void)invalidateRestorableState

    Discussion

    Call this method whenever the restorable state of your responder changes. This method marks the responder’s state as dirty, which causes that state to be written to disk at some point in the future. Do not override this method.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • An object encapsulating a user activity supported by this responder.

    Declaration

    Swift

    var userActivity: NSUserActivity?

    Objective-C

    @property(strong) NSUserActivity *userActivity

    Discussion

    By setting the userActivity property on a responder, the NSUserActivity object becomes managed by AppKit. You should override updateUserActivityState: to write lazily any state data representing the user’s activity to the userInfo dictionary. User activities managed by AppKit are saved automatically at appropriate times. Multiple responders can share a single NSUserActivity instance, in which case they all get an updateUserActivityState: callback.

    On OS X, NSUserActivity objects managed by NSResponder automatically becomeCurrent based on the main window and the responder chain.

    A responder object can set its userActivity property to nil if it no longer wants to participate. Any NSUserActivity objects that are managed by AppKit but which have no associated responders (or documents) are automatically invalidated.

    This property can be used from any thread. It is KVO observable.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.10 and later.

  • Restores the state needed to continue the given user activity.

    Declaration

    Swift

    func restoreUserActivityState(_ activity: NSUserActivity)

    Objective-C

    - (void)restoreUserActivityState:(NSUserActivity *)activity

    Parameters

    activity

    The user activity to be continued.

    Discussion

    Subclasses override this method to restore the responder’s state with the given user activity. The system calls it on any objects passed to the restoration handler given to application:continueUserActivity:restorationHandler:. The override should use the state data contained in the userInfo dictionary of the given user activity to restore the object.

    You may also call this method directly if the app delegate chooses not to use the restoration handler.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.10 and later.

    See Also

    userActivity
    – updateUserActivityState:

  • Updates the state of the given user activity.

    Declaration

    Swift

    func updateUserActivityState(_ activity: NSUserActivity)

    Objective-C

    - (void)updateUserActivityState:(NSUserActivity *)activity

    Parameters

    activity

    The user activity to be updated.

    Discussion

    Subclasses override this method to update the state of the given user activity. You should add state representing the user's activity into the NSUserActivity object using its addUserInfoEntriesFromDictionary: method. When the state is dirty, you should set the needsSave property of the NSUserActivity to YEStrue, and this method will be called at an appropriate time.

    When an NSUserActivity object managed by AppKit is updated, an empty userInfo dictionary is given to the NSUserActivity object, and all of the objects associated with the NSUserActivity are then sent an updateUserActivityState: message.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.10 and later.

    See Also

    userActivity
    – restoreUserActivityState:

  • Presents an error alert to the user as an application-modal dialog.

    Declaration

    Swift

    func presentError(_ anError: NSError) -> Bool

    Objective-C

    - (BOOL)presentError:(NSError *)anError

    Parameters

    anError

    An object containing information about an error.

    Discussion

    The alert displays information found in the NSError object anError; this information can include error description, recovery suggestion, failure reason, and button titles (all localized). The method returns YEStrue if error recovery succeeded and NOfalse otherwise. For error recovery to be attempted, an recovery-attempter object (that is, an object conforming to the NSErrorRecoveryAttempting informal protocol) must be associated with anError.

    The default implementation of this method sends willPresentError: to self. By doing this, NSResponder gives subclasses an opportunity to customize error presentation. It then forwards the message, passing any customized error object, to the next responder; if there is no next responder, it passes the error object to NSApp, which displays a document-modal error alert. When the user dismisses the alert, any recovery attempter associated with the error object is given a chance to recover from the error. See the class description for the precise route up the responder chain (plus document and controller objects) this message might travel.

    It is not recommended that you attempt to override this method. If you wish to customize the error presentation, override willPresentError: instead.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Presents an error alert to the user as a document-modal sheet attached to document window.

    Declaration

    Swift

    func presentError(_ error: NSError, modalForWindow aWindow: NSWindow, delegate delegate: AnyObject?, didPresentSelector didPresentSelector: Selector, contextInfo contextInfo: UnsafeMutablePointer<Void>)

    Objective-C

    - (void)presentError:(NSError *)error modalForWindow:(NSWindow *)aWindow delegate:(id)delegate didPresentSelector:(SEL)didPresentSelector contextInfo:(void *)contextInfo

    Parameters

    error

    The object encapsulating information about the error.

    aWindow

    The window object identifying the window owning the document-modal sheet.

    delegate

    The modal delegate for the sheet.

    didPresentSelector

    A selector identifying the message to be sent to the modal delegate. The didPresentSelector selector must have the signature:

    • - (void)didPresentErrorWithRecovery:(BOOL)didRecover
    • contextInfo:(void *)contextInfo
    contextInfo

    Supplemental data to be passed to the modal delegate; can be NULL.

    Discussion

    The information displayed in the alert is extracted from the NSError object error; it may include a description, recovery suggestion, failure reason, and button titles (all localized). Once the user dismisses the alert and any recovery attempter associated with the error object has had a chance to recover from it, the receiver sends a message identified by didPresentSelector to the modal delegate delegate. (A recovery attempter is an object that conforms to the NSErrorRecoveryAttempting informal protocol.)

    The modal delegate implements the method identified by didPresentSelector to perform any post-error processing if recovery failed or was not attempted (that is, didRecover is NOfalse). Any supplemental data is passed to the modal delegate via contextInfo.

    The default implementation of this method sends willPresentError: to self. By doing this, NSResponder gives subclasses an opportunity to customize error presentation. It then forwards the message, passing any customized error, to the next responder or; if there is no next responder, it passes the error object to NSApp, which displays a document-modal error alert. When the user dismisses the alert, any recovery attempter associated with the error object is given a chance to recover from the error. See the class description for the precise route up the responder chain (plus document and controller objects) this message might travel.

    It is not recommended that you attempt to override this method. If you wish to customize the error presentation, override willPresentError: instead.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Implemented by subclasses to return a custom version of the supplied error object that is more suitable for presentation in alert sheets and dialogs.

    Declaration

    Swift

    func willPresentError(_ anError: NSError) -> NSError

    Objective-C

    - (NSError *)willPresentError:(NSError *)anError

    Parameters

    anError

    The error object to be customized.

    Return Value

    The customized error object; if you decide not to customize the error presentation, return by sending this message to super (that is, return [super willPresentError:anError]).

    Discussion

    When overriding this method, you can examine anError and, if its localized description or recovery information is unhelpfully generic, return an error object with more specific localized text. If you do this, always use the domain and error code of the NSError object to distinguish between errors whose presentation you want to customize and those you do not. Don’t make decisions based on the localized description, recovery suggestion, or recovery options because parsing localized text is problematic.

    The default implementation of this method simply returns anError unchanged.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.4 and later.

  • Attempts to perform the indicated command.

    Declaration

    Swift

    func doCommandBySelector(_ aSelector: Selector)

    Objective-C

    - (void)doCommandBySelector:(SEL)aSelector

    Parameters

    aSelector

    The selector identifying the method.

    Discussion

    If the receiver responds to aSelector, it invokes the method with nil as the argument. If the receiver doesn’t respond, it sends this message to its next responder with the same selector. NSWindow and NSApplication also send the message to their delegates. If the receiver has no next responder or delegate, it beeps.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Attempts to perform the action indicated method with a specified argument.

    Declaration

    Swift

    func tryToPerform(_ anAction: Selector, with anObject: AnyObject?) -> Bool

    Objective-C

    - (BOOL)tryToPerform:(SEL)anAction with:(id)anObject

    Parameters

    anAction

    The selector identifying the action method.

    anObject

    The object to use as the sole argument of the action method.

    Return Value

    Returns NOfalse if no responder is found that responds to anAction, YEStrue otherwise.

    Discussion

    If the receiver responds to anAction, it invokes the method with anObject as the argument and returns YEStrue. If the receiver doesn’t respond, it sends this message to its next responder with the same selector and object.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • menu menu Property

    Returns the responder’s menu.

    Declaration

    Swift

    var menu: NSMenu?

    Objective-C

    @property(strong) NSMenu *menu

    Discussion

    For NSApplication this menu is the same as the menu returned by its mainMenu property.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    menuForEvent: (NSView)
    defaultMenu (NSView)

  • Overridden by subclasses to determine what services are available.

    Declaration

    Swift

    func validRequestorForSendType(_ sendType: String, returnType returnType: String) -> AnyObject?

    Objective-C

    - (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType

    Parameters

    sendType

    A string identifying the send type of pasteboard data. May be an empty string (see discussion).

    returnType

    A string identifying the return type of pasteboard data. May be an empty string (see discussion).

    Return Value

    If the receiver can place data of sendType on the pasteboard and receive data of returnType, it should return self; otherwise it should return either [super validRequestorForSendType:returnType:] or [[self nextResponder] validRequestorForSendType:returnType:], which allows an object higher up in the responder chain to have an opportunity to handle the message.

    Discussion

    With each event, and for each service in the Services menu, the application object sends this message up the responder chain with the send and return type for the service being checked. This method is therefore invoked many times per event. The default implementation simply forwards this message to the next responder, ultimately returning nil.

    Either sendType or returnType—but not both—may be empty. If sendType is empty, the service doesn’t require input from the application requesting the service. If returnType is empty, the service doesn’t return data.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    See Also

    registerServicesMenuSendTypes:returnTypes: (NSApplication)
    writeSelectionToPasteboard:types: (NSServicesRequests protocol)
    readSelectionFromPasteboard: (NSServicesRequests protocol)

  • The undo manager for this responder.

    Declaration

    Swift

    var undoManager: NSUndoManager? { get }

    Objective-C

    @property(readonly, strong) NSUndoManager *undoManager

    Discussion

    The NSResponder implementation simply invokes this property on the next responder.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns YEStrue if the specified event should be treated as an ink event, NOfalse if it should be treated as a mouse event.

    Declaration

    Swift

    func shouldBeTreatedAsInkEvent(_ theEvent: NSEvent) -> Bool

    Objective-C

    - (BOOL)shouldBeTreatedAsInkEvent:(NSEvent *)theEvent

    Parameters

    theEvent

    An event object representing the event to be tested.

    Discussion

    This method provides the ability to distinguish when a pen-down should start inking versus when a pen-down should be treated as a mouse down event. This allows for a write-anywhere model for pen-based input.

    The default implementation in NSApplication sends the method to the NSWindow object under the pen. If the window is inactive, this method returns YEStrue, unless the pen-down is in the window drag region. If the window is active, this method is sent to the NSView object under the pen.

    The default implementation in NSView returns YEStrue, and NSControl overrides and returns NOfalse. This allows write-anywhere over most NSView objects, but allows the pen to be used to track in controls and to move windows.

    A custom view should override this method to get the correct behavior for a pen-down in the view.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.2 and later.

  • Handles the case where an event or action message falls off the end of the responder chain.

    Declaration

    Swift

    func noResponderFor(_ eventSelector: Selector)

    Objective-C

    - (void)noResponderFor:(SEL)eventSelector

    Parameters

    eventSelector

    A selector identifying the action or event message.

    Discussion

    The default implementation beeps if eventSelector is keyDown:.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Sets the receiver’s style to the style specified by interfaceStyle, such as NSMacintoshInterfaceStyle or NSWindows95InterfaceStyle.

    Declaration

    Objective-C

    - (void)setInterfaceStyle:(NSInterfaceStyle)interfaceStyle

    Parameters

    interfaceStyle

    An enum constant identifying an interface style.

    Discussion

    setInterfaceStyle: is an abstract method in NSResponder, but is overridden in classes such as NSWindow and NSView to actually set the interface style. You should almost never need to invoke or override this method, but if you do override it, your version should always invoke the implementation in super.

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Available in OS X v10.0 and later.

    Deprecated in OS X v10.8.

  • Returns the receiver’s interface style.

    Declaration

    Objective-C

    - (NSInterfaceStyle)interfaceStyle

    Discussion

    interfaceStyle is an abstract method in NSResponder and just returns NSNoInterfaceStyle. It is overridden in classes such as NSWindow and NSView to return the interface style, such as NSMacintoshInterfaceStyle. A responder’s style (if other than NSNoInterfaceStyle) overrides all other settings, such as those established by the defaults system.

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Available in OS X v10.0 and later.

    Deprecated in OS X v10.8.

  • Informs the receiver that the user has begun a touch gesture.

    Declaration

    Swift

    func beginGestureWithEvent(_ event: NSEvent)

    Objective-C

    - (void)beginGestureWithEvent:(NSEvent *)event

    Parameters

    event

    An event object representing the gesture beginning.

    Discussion

    The event will be sent to the view under the touch in the key window.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Informs the receiver that the user has ended a touch gesture.

    Declaration

    Swift

    func endGestureWithEvent(_ event: NSEvent)

    Objective-C

    - (void)endGestureWithEvent:(NSEvent *)event

    Parameters

    event

    An event object representing the gesture end.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Informs the receiver that the user has begun a pinch gesture.

    Declaration

    Swift

    func magnifyWithEvent(_ event: NSEvent)

    Objective-C

    - (void)magnifyWithEvent:(NSEvent *)event

    Parameters

    event

    An event object representing the magnify gesture.

    Discussion

    The event will be sent to the view under the touch in the key window.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Informs the receiver that the user has begun a rotation gesture.

    Declaration

    Swift

    func rotateWithEvent(_ event: NSEvent)

    Objective-C

    - (void)rotateWithEvent:(NSEvent *)event

    Parameters

    event

    An event object representing the rotate gesture.

    Discussion

    The event will be sent to the view under the touch in the key window.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Informs the receiver that the user has begun a swipe gesture.

    Declaration

    Swift

    func swipeWithEvent(_ event: NSEvent)

    Objective-C

    - (void)swipeWithEvent:(NSEvent *)event

    Parameters

    event

    An event object representing the swipe gesture.

    Discussion

    The event will be sent to the view under the touch in the key window.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.5 and later.

  • Informs the receiver that new set of touches has been recognized.

    Declaration

    Swift

    func touchesBeganWithEvent(_ event: NSEvent)

    Objective-C

    - (void)touchesBeganWithEvent:(NSEvent *)event

    Parameters

    event

    An event object representing the beginning of a touch.

    Discussion

    The event will be sent to the view under the touch in the key window. To get the set of touches that began for this view (or descendants of this view) send [event touchesMatchingPhase:NSTouchPhaseBegan inView:self].

    This is not always the point of contact with the touch device. A touch that transitions from resting to active may be part of a touchesBeganWithEvent: set.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Informs the receiver that one or more touches has moved.

    Declaration

    Swift

    func touchesMovedWithEvent(_ event: NSEvent)

    Objective-C

    - (void)touchesMovedWithEvent:(NSEvent *)event

    Parameters

    event

    An event object representing a touch movement.

    Discussion

    The event will be sent to the view under the touch in the key window. To get the set of touches that moved for this view (or descendants of this view) send [event touchesMatchingPhase:NSTouchPhaseMoved inView:self].

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Informs the receiver that tracking of touches has been cancelled for any reason.

    Declaration

    Swift

    func touchesCancelledWithEvent(_ event: NSEvent)

    Objective-C

    - (void)touchesCancelledWithEvent:(NSEvent *)event

    Parameters

    event

    An event object representing the cancellation of a touch event.

    Discussion

    The event will be sent to the view under the touch in the key window.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Returns that a set of touches have been removed.

    Declaration

    Swift

    func touchesEndedWithEvent(_ event: NSEvent)

    Objective-C

    - (void)touchesEndedWithEvent:(NSEvent *)event

    Parameters

    event

    An event object representing the ending of a touch event.

    Discussion

    The event will be sent to the view under the touch in the key window. To get the set of touches that ended for this view (or descendants of this view) send [event touchesMatchingPhase:NSTouchPhaseEnded inView:self].

    This is not always the point of removal with the touch device. A touch that transitions from active to resting may be part of an touchesEndedWithEvent: set.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Returns whether to forward elastic scrolling gesture events up the responder.

    Declaration

    Swift

    func wantsForwardedScrollEventsForAxis(_ axis: NSEventGestureAxis) -> Bool

    Objective-C

    - (BOOL)wantsForwardedScrollEventsForAxis:(NSEventGestureAxis)axis

    Parameters

    axis

    The gesture axis. See NSEventGestureAxis for the possible values.

    Return Value

    Returns YEStrue when forward gesture scroll events should be forwarded up the responder chain when the scrolling content is already at the edge of the scrolled direction at the beginning of the scroll gesture; NOfalse otherwise.

    Discussion

    Some views process gesture scroll events to perform elastic scrolling. In some cases, you may want to track gesture scroll events like a swipe, see trackSwipeEventWithOptions:dampenAmountThresholdMin:max:usingHandler:.

    Implement this method and return YEStrue in your swipe controller and views that perform elastic scrolling will forward gesture scroll events up the responder chain on the following condition: the content to be scrolled is already at the edge of the scrolled direction at the beginning of the scroll gesture.

    Otherwise, the view will perform elastic scrolling.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • Informs the receiver that the user performed a smart zoom gesture.

    Declaration

    Swift

    func smartMagnifyWithEvent(_ event: NSEvent)

    Objective-C

    - (void)smartMagnifyWithEvent:(NSEvent *)event

    Parameters

    event

    An event object representing the smart zoom gesture.

    Discussion

    The smart zoom gesture is a two-finger double tap on trackpads. In response to this event, you should intelligently magnify the content.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.8 and later.

  • Implement this method to track gesture scroll events such as a swipe.

    Declaration

    Swift

    func wantsScrollEventsForSwipeTrackingOnAxis(_ axis: NSEventGestureAxis) -> Bool

    Objective-C

    - (BOOL)wantsScrollEventsForSwipeTrackingOnAxis:(NSEventGestureAxis)axis

    Parameters

    axis

    The event gesture axis of the swipe, which defines the scroll direction.

    Return Value

    YEStrue if gesture scroll events are to be forwarded up the responder chain; otherwise NOfalse. The default implementation returns NOfalse.

    Discussion

    Implement this method in your swipe controller and return YEStrue to inform views that perform elastic scrolling to forward gesture scroll events up the responder chain. The events are forwarded only on the following condition: the content to be scrolled is already at the edge of the scrolled direction when the scroll gesture begins. Otherwise, the view performs elastic scrolling. The default implementation returns NOfalse.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.7 and later.

  • Sets the paragraph base writing direction to be left to right.

    Declaration

    Swift

    func makeBaseWritingDirectionLeftToRight(_ sender: AnyObject?)

    Objective-C

    - (void)makeBaseWritingDirectionLeftToRight:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    Sets the NSAttributedString key NSWritingDirectionAttributeName to NSWritingDirectionLeftToRight.

    This action method is intended to be used both as the target of a menu item and for key bindings. The base writing direction methods should be the target of three menu items in a submenu, under the Edit menu.

    Default key bindings will also be provided for this method but will only be enabled for users of Hebrew or Arabic, or those who have otherwise enabled a suitable preference.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Sets the paragraph base writing direction to be natural.

    Declaration

    Swift

    func makeBaseWritingDirectionNatural(_ sender: AnyObject?)

    Objective-C

    - (void)makeBaseWritingDirectionNatural:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    Natural directionality is determined from the text in accordance with the Unicode bidi algorithm. For more information see NSParagraphStyle.

    Sets the NSAttributedStringkey NSWritingDirectionAttributeName to NSTextWritingDirectionEmbedding.

    This action method is intended to be used both as the target of a menu item and for key bindings. The base writing direction methods should be the target of three menu items in a submenu, under the Edit menu.

    Default key bindings will also be provided for this method but will only be enabled for users of Hebrew or Arabic, or those who have otherwise enabled a suitable preference.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Sets the paragraph base writing direction to be right to left.

    Declaration

    Swift

    func makeBaseWritingDirectionRightToLeft(_ sender: AnyObject?)

    Objective-C

    - (void)makeBaseWritingDirectionRightToLeft:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    Sets the NSAttributedString key NSWritingDirectionAttributeName to NSWritingDirectionRightToLeft.

    This action method is intended to be used both as the target of a menu item and for key bindings. The base writing direction methods should be the target of three menu items in a submenu, under the Edit menu.

    Default key bindings will also be provided for this method but will only be enabled for users of Hebrew or Arabic, or those who have otherwise enabled a suitable preference.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Sets the character level attributed string direction attribute for left to right text.

    Declaration

    Swift

    func makeTextWritingDirectionLeftToRight(_ sender: AnyObject?)

    Objective-C

    - (void)makeTextWritingDirectionLeftToRight:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    Sets the NSAttributedString NSWritingDirectionAttributeName to NSWritingDirectionLeftToRight.

    This action method is intended to be used both as the target of a menu item and for key bindings. The text writing directions should be the target of three similar menu items in a submenu under the Edit menu.

    Default key bindings will also be provided for this method but will only be enabled for users of Hebrew or Arabic, or those who have otherwise enabled a suitable preference.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Removes the character-level writing direction attribute

    Declaration

    Swift

    func makeTextWritingDirectionNatural(_ sender: AnyObject?)

    Objective-C

    - (void)makeTextWritingDirectionNatural:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    Removes the NSWritingDirectionAttributeName from an NSAttributedString.

    This action method is intended to be used both as the target of a menu item and for key bindings. The text writing directions should be the target of three similar menu items in a submenu under the Edit menu.

    Default key bindings will also be provided for this method but will only be enabled for users of Hebrew or Arabic, or those who have otherwise enabled a suitable preference.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Sets the character-level writing direction attribute to a single right-to-left embedding.

    Declaration

    Swift

    func makeTextWritingDirectionRightToLeft(_ sender: AnyObject?)

    Objective-C

    - (void)makeTextWritingDirectionRightToLeft:(id)sender

    Parameters

    sender

    Typically the object that invoked this method.

    Discussion

    Sets the NSAttributedString key NSWritingDirectionAttributeName to NSWritingDirectionRightToLeft.

    This action method is intended to be used both as the target of a menu item and for key bindings. The text writing directions should be the target of three similar menu items in a submenu under the Edit menu.

    Default key bindings will also be provided for this method but will only be enabled for users of Hebrew or Arabic, or those who have otherwise enabled a suitable preference.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Performs all find oriented actions.

    Declaration

    Swift

    func performTextFinderAction(_ sender: AnyObject?)

    Objective-C

    - (void)performTextFinderAction:(id)sender

    Parameters

    sender

    The sender of the find action.

    Discussion

    When an application performs a find action, it should send this message to the responder chain.

    A responder of performTextFinderAction: is responsible for creating and owning an instance of NSTextFinder. Before any other messages are sent to the NSTextFinder, you should set its 'client' property to an object which implements the NSTextFinderClient protocol.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.7 and later.