setCandidates(_:forSelectedRange:in:)
Sets an array of candidate objects to be displayed in the candidate list bar item.
Declaration
func setCandidates(_ candidates: [CandidateType], forSelectedRange selectedRange: NSRange, in originalString: String?)Parameters
- candidates:
The array of candidates you wish to display in the candidate list item.
- selectedRange:
A range (Nsrange C.struct) 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.