Skip to content

iOS Spotlight Search | Core Spotlight implemented sample project (Swift 5, iOS 9+)

Notifications You must be signed in to change notification settings

omerfarukozturk/Spotlight-Search-iOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Spotlight Search

Core Spotlight is a popular feature in iOS 9.0 that lets your app contents to appear on iOS Spotlight Search result, so that users can find content of your apps alongside other applications.

Core Spotlight is integrated in this sapmle app via a manager file named SpotlightManager.

Integration Steps

Add SpotlightManager.swift file to your project.

Add this delegate function in AppDelegate.swift to handle Spotlight Item tap action.

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
    // Called when Spotlight item tapped. Do anything with specified data.
    SpotlightManager.sharedInstance.spotlightItemTapAction(userActivity)
    return true
}

There is a sample function in SpotlightManager that you can simply call. In this project it is called on application launch in didFinishLaunchingWithOptions delegate in AppDelegate.swift.

SpotlightManager.sharedInstance.reloadInitialItems()

When user tap to an item in Spotlight Search results, spotlightItemTapAction function is called. You can edit this function to do any action you want.

That is all.

Sample Gif

About

iOS Spotlight Search | Core Spotlight implemented sample project (Swift 5, iOS 9+)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages