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.
Asked
Active
Viewed 2,266 times
-2

bytecode77
- 14,163
- 30
- 110
- 141

Abha
- 1,032
- 1
- 13
- 36
-
https://developer.apple.com/documentation/foundation/task_management/continuing_user_activities_with_handoff – Curiosity Jun 19 '21 at 00:25
1 Answers
2
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

Roland Keesom
- 8,180
- 5
- 45
- 52
-
Thanks for help, but this code is not working...after trying this i use to post my question here. – Abha Aug 14 '15 at 06:06
-
This code is working for me, and the link provided in the answer shows how to implement it. – Roland Keesom Aug 14 '15 at 07:11