> This page is for SDK, version Legacy.
> For other versions, use one of these documentation indexes:
> - Current (default): https://buildwithfern.com/learn/sdks/current/llms.txt
> - Legacy: https://buildwithfern.com/learn/sdks/legacy/llms.txt

> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt.

# Publishing as a Swift package

> How to publish the Fern Swift SDK as a Swift package

> **You're viewing the legacy SDK docs**
>
> These pages cover SDK generation configured with `generators.yml`. New projects use `sdk-config.yml`, so see [the Current version of this page](/learn/sdks/generators/swift/publishing) for up-to-date guidance. To move an existing project, follow the [SDK Config migration guide](/learn/sdks/legacy/generators/migration-guides/sdk-config), which walks through `fern sdk migrate`, and review the [`sdk-config.yml` reference](/learn/sdks/reference/sdk-config).

> **Enterprise feature**
>
> This feature is available only for the [Enterprise plan](https://buildwithfern.com/pricing). To get started, reach out to [support@buildwithfern.com](mailto:support@buildwithfern.com).

Publish your public-facing Fern Swift SDK as a Swift package distributed via Git. After following the steps on this page, you'll have a versioned package that developers can install using Swift Package Manager.

> **Info**
>
> This page assumes that you have:
>
> * An initialized `fern` folder, a GitHub repository for your Swift SDK, and a Swift generator group in `generators.yml`. See [Generating an SDK (Swift)](/learn/sdks/legacy/generators/swift/quickstart).

## Configure `generators.yml`

#### Configure \`output\` location

Swift packages are distributed via Git repositories, so remove the auto-generated `output` and `config` properties. Instead, add the path to your GitHub repository:

**`generators.yml`**

```yaml {6-7} title="generators.yml"
groups: 
  swift-sdk:
    generators:
      - name: fern-swift-sdk
        version: 0.37.1
        github:
          repository: your-org/company-swift
```

## Publish as a Swift package

At this point, you're ready to generate a release for your SDK.

#### Generate your release

Regenerate your SDK and publish it to your repository:

```bash
fern generate --group swift-sdk --version <version>
```

Local machine output will verify that the release is pushed to your repository and tagged with the version you specified.

#### Verify package availability

Your Swift package is now available! Developers can add it to their projects by:

* **In Xcode**: File → Add Package Dependencies → Enter your repository URL
* **In Package.swift**: Add to dependencies array:

```swift
dependencies: [
    .package(url: "https://github.com/<github-org>/<github-repo-name>", from: "<version>")
]
```

> **Tip**
>
> Unlike other languages that rely on centralized registries, Swift packages are available as soon as they’re tagged and pushed to a Git repository.
>
> You can optionally submit your package to the community-maintained [Swift Package Index](https://swiftpackageindex.com/) for better discoverability.