Instance Method

setCandidates:forSelectedRange:inString:

Sets an array of candidate objects to be displayed in the candidate list bar item.

Declaration

- (void)setCandidates:(NSArray<CandidateType> *)candidates forSelectedRange:(NSRange)selectedRange inString:(NSString *)originalString;

Parameters

candidates

The array of candidates you wish to display in the candidate list item.

selectedRange

A range (NSRange) within the string that the candidates represent.

originalString

The original string from which the candidate list was derived.

Discussion

The item uses the block in the attributedStringForCandidate property to convert each candidate in the array into an attributed string. If the value of the attributedStringForCandidate property is nil then NSCandidateListTouchBarItem can format candidates of type NSString, NSAttributedString, and NSTextCheckingResult.

See Also

Populating the Candidate List

candidates

The array of candidate objects previously set by setCandidates:forSelectedRange:inString:.

attributedStringForCandidate

A block that converts a candidate object into an attributed string for display in the candidate list item.

allowsTextInputContextCandidates

A Boolean value that specifies whether a candidate list item displays candidates from text input providers.