---
title: FileSource
framework: corespotlight
role: symbol
role_heading: Structure
path: corespotlight/filesource
---

# FileSource

A search source that retrieves indexed metadata from files and directories visible to Spotlight.

## Declaration

```swift
struct FileSource
```

## Mentioned in

Making your indexed content available to Foundation Models

## Overview

Overview 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.

## Topics

### Creating a file source

- [init(fetchAttributes:)](corespotlight/filesource/init(fetchattributes:).md)

### Configuring the search options

- [fetchAttributes](corespotlight/filesource/fetchattributes.md)
- [scopes](corespotlight/filesource/scopes.md)
- [maximumResultCount](corespotlight/filesource/maximumresultcount.md)

## Relationships

### Conforms To

- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Data sources

- [SearchSource](corespotlight/searchsource.md)
- [CoreSpotlightSource](corespotlight/corespotlightsource.md)
- [SearchableItemAttribute](corespotlight/searchableitemattribute.md)
