Spotlight Search Integration for iOS Apps
Instead of navigating through an app's interface, users increasingly search for content directly from the system Spotlight search. Integrating Spotlight Search with CoreSpotlight and NSUserActivity makes your content discoverable, boosting repeat visits by 30%. Over 7 years we have implemented indexing for 15+ iOS projects — from startups to enterprise — and know how to correctly configure CoreSpotlight, NSUserActivity, and Siri Shortcuts.
We share practical experience: how using batch indexing reduces catalog update time from 5 minutes to 40 seconds for 10,000 products, how to avoid common mistakes with domainIdentifier, and how to set up deep links that work even in iOS multi-window mode.
What Problems Spotlight Search Integration Solves
Spotlight Search addresses three key tasks: quick access to content, increased engagement, and system integration. Users find products, articles, or contacts directly from the home screen without opening the app. Conversion to repeat visits increases by 20–30%. NSUserActivity and Siri Suggestions prompt users to continue recent actions, increasing session time. Deep links from Spotlight, Universal Links, and Handoff allow seamless return to the app.
Typical Indexing Mistakes
- Missing
domainIdentifier— all elements mix together, making deletion by type difficult. - Indexing items one by one on each load — causes frequent reindexing and battery drain.
- Not handling
NSUserActivityin multi-window mode — the deep link may fail inscene(_:willConnectTo:options:)orscene(_:continue:).
How We Do It: Tech Stack and Configs
We use three APIs depending on content type:
| API | Purpose | When to Use |
|---|---|---|
CSSearchableIndex |
Persistent content index (articles, products) | On data load from backend |
NSUserActivity |
Current activities (viewed pages) | In viewDidAppear / viewDidDisappear |
AppIntents + CoreSpotlight |
Siri Shortcuts and voice search | iOS 16+, for quick commands |
Case Study: Catalog with 10,000 Products
For a client running an e‑commerce store with a catalog of 10,000 products, we used batch indexing via CSSearchableIndex.default().indexSearchableItems(_:), sending 100 items at a time with a pause between batches. For each product we created a CSSearchableItem with uniqueIdentifier = "product-\(product.id)" and domainIdentifier = "products". After each server sync we updated only changed records using fetchLastClientState() and beginBatch()/endBatch(). The result: full reindexing time dropped from 5 minutes to 40 seconds — roughly 15 times faster than one-by-one. Batch indexing also reduces battery load and provides atomic updates.
What to Do If a Deep Link from Spotlight Fails
Deep links from Spotlight are handled via NSUserActivity. Ensure that uniqueIdentifier matches the one passed in application(_:continue:restorationHandler:). In SwiftUI use the .onContinueUserActivity modifier. Here is a minimal implementation:
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) { guard userActivity.activityType == CSSearchableItemActionType, let identifier = userActivity.userInfo?[CSSearchableItemActivityIdentifier] as? String else { return } // Navigate to content with identifier } Check that activityType is set to CSSearchableItemActionType and that uniqueIdentifier is correct with no extra characters. In multi‑window mode, ensure handling is also implemented in the UISceneDelegate.
Our Work Process
- Analysis — study content structure and indexing requirements (data types, depth, need for Handoff).
-
Design — choose API, design
uniqueIdentifieranddomainIdentifierscheme, define index update logic. - Implementation — implement indexing, deep link handling, support for multi‑scene launch.
- Testing — verify all scenarios: search, transition, index deletion, parallel operation of multiple scenes.
- Deployment — publish to App Store, set up error monitoring via Crashlytics.
What’s Included
- Indexing of main content via
CSSearchableIndex. - Adding
NSUserActivityfor recent actions. - Handoff and Siri Suggestions support.
- Deep link handling from Spotlight and Universal Links.
- Removal of outdated entries when content is deleted.
- Documentation on indexing and instructions for content managers.
Estimated Timelines
- Basic indexing — 1 to 2 weeks. Includes indexing one content type and deep link handling.
- Full integration — 3 to 5 weeks. Includes batch indexing, NSUserActivity, Siri Shortcuts support, and index updates.
- Pricing is calculated individually based on catalog size and deep link scheme complexity. Contact us for a free project assessment.
Why Batch Indexing Is More Efficient
For large volumes, use the transaction model:
CSSearchableIndex.default().fetchLastClientState { state, error in let batch = CSSearchableIndex.default() batch.beginBatch() // Add items batch.indexSearchableItems(items) batch.endBatch(withClientState: state) { error in if let error { print("Batch error:", error) } } } This approach is roughly 15 times faster than one‑by‑one indexing and updates the index atomically.
| Parameter | One‑by‑one indexing | Batch indexing |
|---|---|---|
| Speed | ~5 minutes per 10,000 | ~40 seconds |
| Battery load | High | Low |
| Atomicity | No | Yes |
Why Removing Outdated Content Matters
If you do not delete removed products or articles from Spotlight, users will follow a link and see an empty screen. This reduces trust in the app. Delete items via deleteSearchableItems(withIdentifiers:) or deleteSearchableItems(withDomainIdentifiers:) immediately after removing from the database.
Additional Recommendations
- Do not index private data (personal messages, passwords) without explicit consent — Apple checks this during review.
- Use
isEligibleForPrediction = truefor Siri Suggestions to have the app suggested in Siri. - Respect limits: maximum item size 64 KB, no more than 1000 items per
indexSearchableItemscall.
Request a consultation — we will assess your project for free and suggest the optimal solution. Contact us to discuss integration details.







