Class

CSSearchableItem

An item that can be indexed and made available to users when they search on their devices.

Declaration

class CSSearchableItem : NSObject

Overview

To make content searchable, create an attribute set that contains properties that specify the metadata you want to display about an item in a search result. Typically, you want to set at least the following attributes: title, contentDescription, thumbnailData, rating, and keywords. For more information, see init(itemContentType:).

Next, call init(uniqueIdentifier:domainIdentifier:attributeSet:) to create a searchable item related to your attribute set. Then add the item to the index by using indexSearchableItems(_:completionHandler:). If you need to delete items from the index, use the appropriate CSSearchableIndex method, such as deleteSearchableItems(withIdentifiers:completionHandler:).

Topics

Getting a Searchable Item

init(uniqueIdentifier: String?, domainIdentifier: String?, attributeSet: CSSearchableItemAttributeSet)

Returns a searchable item associated with the specified identifier, domain identifier, and attribute set.

Setting Attributes on a Searchable Item

var attributeSet: CSSearchableItemAttributeSet

The set of attributes that contain metadata associated with the item in a CSSearchableItemAttributeSet object.

var domainIdentifier: String?

An optional identifier that represents the domain or owner of the item.

var expirationDate: Date!

The date after which the searchable item should no longer exist.

var uniqueIdentifier: String

The value that uniquely identifies the searchable item within your app.

Continuing a Search or Activity

let CSSearchableItemActionType: String

Indicates that the activity type to continue is related to a searchable item.

let CSSearchableItemActivityIdentifier: String

Provides the key within the NSUserActivity object’s userInfo dictionary for which the value is the searchable item’s unique identifier .

let CSQueryContinuationActionType: String

Indicates that the activity type to continue is a search or query.

let CSSearchQueryString: String

Provides the key within the NSUserActivity object’s userInfo dictionary for which the value is the string that represents the user’s current query.

Relationships

Inherits From

See Also

First Steps

Making Content Searchable

Describe and index your app content so it is searchable.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software