Mac Developer Library

Developer

AppKit Framework Reference NSTextInputContext Class Reference

Options
Deployment Target:

On This Page
Language:

NSTextInputContext

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

Inheritance


Conforms To


Import Statement


Swift

import AppKit

Objective-C

@import AppKit;

Availability


Available in OS X v10.6 and later.
  • The designated initializer

    Declaration

    Swift

    init(client theClient: NSTextInputClient)

    Objective-C

    - (instancetype)initWithClient:(id<NSTextInputClient>)theClient

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Returns the current, activated, text input context object.

    Declaration

    Swift

    class func currentInputContext() -> NSTextInputContext?

    Objective-C

    + (NSTextInputContext *)currentInputContext

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • client client Property

    The owner of this input context. (read-only)

    Declaration

    Swift

    var client: NSTextInputClient { get }

    Objective-C

    @property(readonly) id< NSTextInputClient > client

    Discussion

    The client (owner) of the input context, typically an NSView instance, retains its NSTextInputContext instance. The NSTextInputContext instance doesn't retain its client.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • A Boolean value that indicates whether the client handles NSGlyphInfoAttributeName or not.

    Declaration

    Swift

    var acceptsGlyphInfo: Bool

    Objective-C

    @property BOOL acceptsGlyphInfo

    Discussion

    The default value is determined by examining the return value from sending a validAttributesForMarkedText message to the client at initialization.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • The set of keyboard input source locales allowed when this input context is active.

    Declaration

    Swift

    var allowedInputSourceLocales: [AnyObject]?

    Objective-C

    @property(copy) NSArray *allowedInputSourceLocales

    Discussion

    NSAllRomanInputSourcesLocaleIdentifier can be specified as a valid locale.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Activates the receiver.

    Declaration

    Swift

    func activate()

    Objective-C

    - (void)activate

    Discussion

    You should not call this method directly; it is invoked by the system. It is provided as an override point for subclasses.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

    See Also

    – deactivate

  • Deactivates the receiver.

    Declaration

    Swift

    func deactivate()

    Objective-C

    - (void)deactivate

    Discussion

    You should not call this method directly; it is invoked by the system. It is provided as an override point for subclasses.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

    See Also

    – activate

  • Tells the Cocoa text input system to handle mouse or key events.

    Declaration

    Swift

    func handleEvent(_ theEvent: NSEvent) -> Bool

    Objective-C

    - (BOOL)handleEvent:(NSEvent *)theEvent

    Parameters

    theEvent

    The event to handle.

    Return Value

    YEStrue if the system consumed the event; otherwise NOfalse.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Tells the Cocoa test input system to discard the current conversion session.

    Declaration

    Swift

    func discardMarkedText()

    Objective-C

    - (void)discardMarkedText

    Discussion

    The client should clear its marked range when sending this message.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Notifies the Cocoa text input system that the position information previously queried via methods like firstRectForCharacterRange:actualRange: needs to be updated.

    Declaration

    Swift

    func invalidateCharacterCoordinates()

    Objective-C

    - (void)invalidateCharacterCoordinates

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • The array of keyboard text input source identifier strings available to the receiver. (read-only)

    Declaration

    Swift

    var keyboardInputSources: [AnyObject]? { get }

    Objective-C

    @property(readonly) NSArray *keyboardInputSources

    Discussion

    The Text Input Source Services API identifies text input sources with text input source identifier strings (for example, com.apple.inputmethod.Kotoeri.Japanese) supplied by the underlying text input sources framework. The ID corresponds to the kTISPropertyInputSourceID attribute.

    For more information on the Text Input Source Services API, see Text Input Source Services Reference.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • The identifier string for the selected keyboard text input source.

    Declaration

    Swift

    var selectedKeyboardInputSource: String?

    Objective-C

    @property(copy) NSString *selectedKeyboardInputSource

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.

  • Returns the display name for the given text input source identifier.

    Declaration

    Swift

    class func localizedNameForInputSource(_ inputSourceIdentifier: String) -> String?

    Objective-C

    + (NSString *)localizedNameForInputSource:(NSString *)inputSourceIdentifier

    Parameters

    inputSourceIdentifier

    The text input source identifier.

    Return Value

    The localized display name for inputSourceIdentifier.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.6 and later.