init
TypeScriptstatic init(fetchAttributes?: Array<_CoreSpotlight_SearchableItemAttribute>): FileSourceSwift declarationinit(fetchAttributes: [SearchableItemAttribute] = [])struct · iOS 27.0+ · SDK 27.1
struct FileSourceA search source that retrieves indexed metadata from files and directories visible to Spotlight. Use this type to search the metadata of your app’s custom file types. Configure the source with one or more directories for the tool to search. During a query, the Spotlight considers only the previously indexed files in those directories. When it finds a match, the tool delivers the item and any attributes you specify in the ``fetchAttributes`` property to the model for consideration. For more information about indexing your app’s files, see ``CSImportExtension``.
static init(fetchAttributes?: Array<_CoreSpotlight_SearchableItemAttribute>): FileSourceSwift declarationinit(fetchAttributes: [SearchableItemAttribute] = [])get fetchAttributes(): Array<_CoreSpotlight_SearchableItemAttribute>Swift declarationvar fetchAttributes: [SearchableItemAttribute]The attributes to fetch for each file or directory 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, you might specify the title of a document and the number of pages it contains. For each item the Spotlight search tool identifies as a result, the tool retrieves the attributes you specify in this property. The tool delivers these attributes together with the item’s identifier to the model so it doesn’t have to request them later. 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 file or directory 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, you might specify the title of a document and the number of pages it contains. For each item the Spotlight search tool identifies as a result, the tool retrieves the attributes you specify in this property. The tool delivers these attributes together with the item’s identifier to the model so it doesn’t have to request them later. 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`.
get scopes(): Array<string>Swift declarationvar scopes: [URL]The directories to search. Specify one or more directory URLs to scope the search to those directories and their subdirectories. The default value of this property is an empty array, which searches all indexed volumes.
set scopes(value: Array<string>)Swift declarationvar scopes: [URL]The directories to search. Specify one or more directory URLs to scope the search to those directories and their subdirectories. The default value of this property is an empty array, which searches all indexed volumes.
No declarations were skipped in this snapshot.