Does anyone have any ideas as to how to go about cropping the image that appears in the spotlight search, so that 'thumbnailData' is a circular image not a square one?
None of these solutions work to the desired effect: Cut a UIImage into a circle Swift(iOS)
I can successfully crop the image but then spotlight feature puts a white background around the cropped/masked border. It's possible with spotlight contacts (kUTTypeContact), just not content from what I can see (kUTTypeContent).
Here is my code for any boffins out there to take a peek:
// For storing attributes into Searchable Dictionary
internal var attributeSet: CSSearchableItemAttributeSet {
let attributeSet = CSSearchableItemAttributeSet(itemContentType: kUTTypeContent as String)
attributeSet.title = "\(firstName) \(surname)"
attributeSet.contentDescription = location
attributeSet.keywords = ["tennis", "scorelord", firstName, surname, handed, location, "\(itnLevel)"]
attributeSet.thumbnailData = UIImageJPEGRepresentation(profileImage, 0.8)
attributeSet.thumbnailData?.displayLayer(<#T##layer: CALayer##CALayer#>)
return attributeSet
}