Reputation: 1082
Can anybody please provide me tutorial or example code in NSUserActivity feature for SearchApi. I am doing lots of RND about this feature but didn't get proper code for this.
Upvotes: -2
Views: 2303
Reputation: 8288
An example would be:
let activity = NSUserActivity(activityType: "com.tutsplus.iOS-9-Search.displayShow")
activity.userInfo = ["name": detailItem.name, "genre": detailItem.genre, "time": detailItem.time]
activity.title = detailItem.name
var keywords = detailItem.name.componentsSeparatedByString(" ")
keywords.append(detailItem.genre)
activity.keywords = Set(keywords)
activity.eligibleForHandoff = false
activity.eligibleForSearch = true
//activity.eligibleForPublicIndexing = true
//activity.expirationDate = NSDate()
activity.becomeCurrent()
See this link for more information and examples
Upvotes: 2