<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreSpotlight",
  "identifier" : "/documentation/CoreSpotlight/SearchSource",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Core Spotlight",
      "FoundationModels"
    ],
    "preciseIdentifier" : "s:31_CoreSpotlight_FoundationModels12SearchSourceV"
  },
  "title" : "SearchSource"
}
-->

# SearchSource

A source of data for Spotlight to search.

```
struct SearchSource
```

## Overview

When configuring the search tool, use this type to specify whether to retrieve data from the
app’s Spotlight index or from files at the specified locations. Each of the sources sets the
scope of the search, along with other parameters.

## Topics

### Searching a Spotlight index

[`static var coreSpotlight: SearchSource`](/documentation/CoreSpotlight/SearchSource/coreSpotlight)

A source that retrieves data from the app’s Spotlight index.

[`static func coreSpotlight(CoreSpotlightSource) -> SearchSource`](/documentation/CoreSpotlight/SearchSource/coreSpotlight(_:))

Returns a source that retrieves data from the app’s Spotlight index.

### Searching files and directories

[`static var files: SearchSource`](/documentation/CoreSpotlight/SearchSource/files)

A source that retrieves data from the files and directories you specify.

[`static func files(FileSource) -> SearchSource`](/documentation/CoreSpotlight/SearchSource/files(_:))

Returns a source that retrieves data from the files and directories you specify.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)