showCorrectionIndicator(of:primaryString:alternativeStrings:forStringIn:view:completionHandler:)
Display a suitable user interface to indicate a correction may need to be made.
Declaration
func showCorrectionIndicator(of type: NSSpellChecker.CorrectionIndicatorType, primaryString: String, alternativeStrings: [String], forStringIn rectOfTypedString: NSRect, view: NSView, completionHandler completionBlock: (@Sendable (String?) -> Void)? = nil)func showCorrectionIndicator(of type: NSSpellChecker.CorrectionIndicatorType, primaryString: String, alternativeStrings: [String], forStringIn rectOfTypedString: NSRect, view: NSView) async -> String?Parameters
- type:
The correction type to display. See Correctionindicatortype for possible values.
- primaryString:
The first string to be displayed, a correction or reversion according to the
typeof indicator. - alternativeStrings:
An array of alternative strings to insert. This array may be empty.
- rectOfTypedString:
The rectangle of the typed text.
- view:
The view in which the correction indicator is to be displayed.
- completionBlock:
The Block called when a the correction indicator is dismissed.
The Block takes one argument:
- acceptedString
The correction string the user excepted. If the user does not select a correction string nil is returned.
Discussion
Only one indicator at a time may be displayed for a given view, and the only thing a client may do with the indicator after displaying it is to dismiss it using the dismissCorrectionIndicator(for:) method.