Created
February 9, 2018 19:55
-
-
Save MathVasc/1d016f03e738bbb9d20637fc8d82e62e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static func setSpotLightIndexes(){ | |
//. | |
//. | |
//. | |
for item in items { | |
//1 | |
let attributeSet = CSSearchableItemAttributeSet(itemContentType: kUTTypeItem as String) | |
//2 | |
attributeSet.keywords = ["Groceries", "Grocery", "List"] | |
attributeSet.title = item.name | |
attributeSet.contentDescription = item.isDone ? "\(item.name!) was bought" : "\(item.name!) wasn't bought" | |
//3 | |
attributeSet.thumbnailData = item.isDone ? UIImagePNGRepresentation(UIImage(named: "Check")) : UIImagePNGRepresentation(UIImage(named:"Uncheck")) | |
//4 | |
searchableItems.append(CSSearchableItem(uniqueIdentifier: item.name!, domainIdentifier: nil, attributeSet: attributeSet)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment