The on-device index.
- iOS 9.0+
- macOS 10.11+
- Core Spotlight
CSSearchable class defines an object that represents the on-device index. In your app, you can designate user activities (that is, activities that can be represented by
NSUser) and app content as eligible for search. Using
CSSearchable APIs, you identify and provide information about activities and other items and then use
CSSearchable methods to manage the indexing of the items.
In some cases, it works well to batch updates to the index and save state information (up to 250 bytes) that helps you handle errors in the process. For example, you can use the client state information you pass in
end to determine where indexing should resume in case of a crash or jetsam. (Note that state information is reset every time
delete is called.) You can batch updates using
delete, but you can’t batch updates to the default index returned by
In batch mode, the client takes responsibility for protecting the private
CSSearchable instance from concurrent access from multiple threads; concurrent calls to the index instance have undefined results. Although you can call
begin again before the completion handler passed to
end has been called, don’t call it before
end has returned.