Created
October 28, 2015 18:40
-
-
Save dhrrgn/40f9dccd761c421ebd75 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
CSSearchableItemAttributeSet *attributeSet; | |
attributeSet = [[CSSearchableItemAttributeSet alloc] initWithItemContentType:(NSString *)kUTTypeImage]; | |
attributeSet.title = @"Some Title"; | |
attributeSet.contentDescription = @"Some Destiption"; | |
attributeSet.keywords = @[@"Some", @"Keyword"]; | |
UIImage *image = [UIImage imageNamed:@"someOptionalImage.png"]; | |
NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(image)]; | |
attributeSet.thumbnailData = imageData; | |
CSSearchableItem *item = [[CSSearchableItem alloc] initWithUniqueIdentifier:@"com.company" | |
domainIdentifier:@"spotlight.myDomain" | |
attributeSet:attributeSet]; | |
[[CSSearchableIndex defaultSearchableIndex] indexSearchableItems:@[item] | |
completionHandler: ^(NSError * __nullable error) { | |
if (!error) { | |
NSLog(@"Search item indexed"); | |
} | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment