init
TypeScriptstatic initFetchAttributes(fetchAttributes?: Array<_CoreSpotlight_SearchableItemAttribute>): CoreSpotlightSourceSwift declarationinit(fetchAttributes: [SearchableItemAttribute] = [])struct · iOS 27.0+ · SDK 27.1
struct CoreSpotlightSourceA search source that retrieves data from the app’s Spotlight index. Use this type to configure the Spotlight search tool to search your app’s indexed content. When performing searches, the tool queries your content for ``CSSearchableItem`` objects that match the specified criteria. When delivering search results to the model, the tool delivers each item’s identifier and any attributes you specify in the ``fetchAttributes`` property. To provide additional item-specific content that isn’t in the Spotlight index, provide a delegate object to generate that data dynamically from your content. This type is `@unchecked Sendable` because ``CSSearchableIndexDelegate`` is a non-Sendable ObjC protocol. If you provide a delegate object, you must ensure that object is safe to use across isolation boundaries.
static initFetchAttributes(fetchAttributes?: Array<_CoreSpotlight_SearchableItemAttribute>): CoreSpotlightSourceSwift declarationinit(fetchAttributes: [SearchableItemAttribute] = [])get fetchAttributes(): Array<_CoreSpotlight_SearchableItemAttribute>Swift declarationvar fetchAttributes: [SearchableItemAttribute]The attributes to fetch for each item and provide to the model. Use this property to minimize the number of round trips between the Spotlight search tool and your content. When you index your app’s content, you create a ``CSSearchableItemAttributeSet`` for each item and fill it with metadata about that item. For example, retrieve the display name, author, and subject attributes by setting this property to `[.displayName, .authors, .subject]`. For each item, the tool retrieves the attributes you specify and delivers them to the model. The default value of this property is an empty set, which delivers only the item’s identifier to the model.
set fetchAttributes(value: Array<_CoreSpotlight_SearchableItemAttribute>)Swift declarationvar fetchAttributes: [SearchableItemAttribute]The attributes to fetch for each item and provide to the model. Use this property to minimize the number of round trips between the Spotlight search tool and your content. When you index your app’s content, you create a ``CSSearchableItemAttributeSet`` for each item and fill it with metadata about that item. For example, retrieve the display name, author, and subject attributes by setting this property to `[.displayName, .authors, .subject]`. For each item, the tool retrieves the attributes you specify and delivers them to the model. The default value of this property is an empty set, which delivers only the item’s identifier to the model.
get maximumResultCount(): (number) | nullSwift declarationvar maximumResultCount: Int?The maximum number of results to retrieve from this source. Use this property to limit the number of results the Spotlight search tool returns to the model. If you specify `nil`, the tool returns all results that match the model’s query. This maximum applies only to the current source, and doesn’t include results from other sources, which have their own maximum values. The default value of this property is `nil`.
set maximumResultCount(value: (number) | null)Swift declarationvar maximumResultCount: Int?The maximum number of results to retrieve from this source. Use this property to limit the number of results the Spotlight search tool returns to the model. If you specify `nil`, the tool returns all results that match the model’s query. This maximum applies only to the current source, and doesn’t include results from other sources, which have their own maximum values. The default value of this property is `nil`.
static initSearchableIndexDelegateFetchAttributes(searchableIndexDelegate?: (Implements<_CoreSpotlight_CSSearchableIndexDelegate> | SDKHandle) | null, fetchAttributes?: Array<_CoreSpotlight_SearchableItemAttribute>): CoreSpotlightSourceSwift declarationinit(searchableIndexDelegate: (any CSSearchableIndexDelegate)? = nil, fetchAttributes: [SearchableItemAttribute] = [])get searchableIndexDelegate(): (SDKHandle) | nullSwift declarationvar searchableIndexDelegate: (any CSSearchableIndexDelegate)?An optional delegate object you use to provide additional data about items in search results. Use this delegate object to provide detailed information about your searchable items to the model. Some information in the Spotlight index is searchable, but not recoverable. For example, Spotlight can’t recover the original text or HTML content you supply for an item. When it needs this information, the search tool asks your delegate to provide a new ``CSSearchableItem`` object with the same content as the original one. If you configure the Spotlight search tool to use the ``SpotlightSearchTool/GuidanceLevel/dynamic(_:)`` guidance level, you can also use this delegate to fill in any missing attributes. Dynamic profiles cause the tool to search specific attributes of each item. If those attributes aren’t available in the index, the tool uses your delegate to recreate the item. If you don't provide a delegate object, the tool uses only the information it retrieves from the source.
set searchableIndexDelegate(value: (Implements<_CoreSpotlight_CSSearchableIndexDelegate> | SDKHandle) | null)Swift declarationvar searchableIndexDelegate: (any CSSearchableIndexDelegate)?An optional delegate object you use to provide additional data about items in search results. Use this delegate object to provide detailed information about your searchable items to the model. Some information in the Spotlight index is searchable, but not recoverable. For example, Spotlight can’t recover the original text or HTML content you supply for an item. When it needs this information, the search tool asks your delegate to provide a new ``CSSearchableItem`` object with the same content as the original one. If you configure the Spotlight search tool to use the ``SpotlightSearchTool/GuidanceLevel/dynamic(_:)`` guidance level, you can also use this delegate to fill in any missing attributes. Dynamic profiles cause the tool to search specific attributes of each item. If those attributes aren’t available in the index, the tool uses your delegate to recreate the item. If you don't provide a delegate object, the tool uses only the information it retrieves from the source.
No declarations were skipped in this snapshot.