can be restored later • NSUserActivity API is used for Handoff • In iOS 9 and later, NSUserActivity objects can be indexed, and displayed in search results on Spotlight.
a Search API for viewed app content • For a more robust Search experience, NSUserActivity is used in combination with Core Spotlight API to index app content (including ones the user hasn’t viewed yet) • NSUserActivity is not intended for indexing arbitrary data within your app
information • First added to private, on-device index • If there’s a lot of user engagement with the public activities in search results, then this will lead to higher rankings in search results, and expanded indexing by Apple (cloud index) • Once the user activity is in the cloud index, it is searchable by anyone who has installed your application, regardless of whether they have opened that particular content or not
using the same methods as those of NSUserActivity • Whenever a CSSearchableItem is selected, a NSUserActivity is created • We’ll revisit our application(_:continueUserActivity:restorationHa ndler:) method in App Delegate
url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool { if let components = NSURLComponents(URL: url, resolvingAgainstBaseURL: true), let path = components.path, let query = components.query { if path == "/Recipes" { //Pass the specific recipe from the URL to the view controller return recipeDetailViewController.loadRecipe(query) } } return false }
5 keywords per item, including synonyms, abbreviations, and category items. • Provide detailed search results using CSSearchableItemAttributeSet • Take user directly to searched content, quickly • Keep search results updated
https://developer.apple.com/videos/play/wwdc2015/709/ WWDC 2015: Seamless Linking into Your App https://developer.apple.com/videos/play/wwdc2015/509/ Ray Wenderlich: Introduction to App Search https://www.raywenderlich.com/116608/ios-9-app-search-tutorial-introduction-to-app-search