---
updatedAt: 2026-09-02T05:22:59.000Z
agentTools:
  siteIndex: https://docs.jfrog.com/llms.txt
  projectIndex: https://docs.jfrog.com/artifactory/llms.txt
---

# Swift Repositories

Configure Swift repositories in JFrog Artifactory to deploy and resolve packages with SPM.

Swift is a general-purpose programming language built using a modern approach to safety, performance, and software design patterns. The Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies. The tool compiles and links Swift packages, managing dependencies, versioning, and supporting flexible distribution and collaboration models. For more information, see <Anchor target="_blank" href="https://docs.swift.org/latest/documentation/packagemanagerdocs">Swift Package Manager documentation</Anchor>.

<Callout icon="📘" theme="info">
  **Note**

  Artifactory supports the public Tuist Swift Package Registry at `https://tuist.dev/api/registry/swift` as a remote upstream. Tuist implements the Swift registry protocol. The URL <Anchor target="_blank" href="https://swiftpackageregistry.com/">https\://swiftpackageregistry.com/</Anchor> is not a Swift registry. It is an HTML catalog of Swift packages that are hosted on Git servers.
</Callout>

![package\_management\_images\_for\_Swift.png](https://files.readme.io/25e2fa256f55f998b3517ab985dd929fe2dd547588ff900a1461c2d76ba3c821-uuid-a9639a93-32e4-eac6-e942-7dfdc82839f1.png)

Artifactory fully supports Swift repositories, including the following capabilities:

* **Robust Metadata Capabilities**: Calculate metadata for Swift packages hosted in Artifactory's local repositories, and validate remote Swift repository metadata.
* **Unified Repository Management**: Consolidate all your Swift repositories in Artifactory as a single source of truth. Set up secure local repositories, access cached versions of remote registries including the public Tuist Swift Package Registry, and create a single access point for all sources with virtual repositories.
* **Support for Swift Package Manager**: Natively use the Swift command line tool to deploy, remove, and manage packages in Artifactory.

## Get Started with Swift

To get started working with Swift, complete the following main steps:

1. [Create a Swift Repository](#create-a-swift-repository "Create a Swift Repository")
2. [Connect Swift to Artifactory](#connect-swift-to-artifactory "Connect Swift to Artifactory")
3. [Deploy](#deploy-swift-packages "Deploy Swift Packages") and [Resolve](#resolve-swift-packages "Resolve Swift Packages") Swift packages ![](https://files.readme.io/c72862c1cd2be6be03211727f417fd48e7bcfc84f0072b4af44b9e6fcafa64cb-uuid-9be4a833-3a7b-9e85-dd25-7a8f8fad62ad.png)

## Create a Swift Repository

This topic describes how to create a Swift repository. This is required before publishing and installing Swift packages. There are three primary types of repositories:

* **Local repositories**: Store and share first- and second-party packages with your organization

* **Remote repositories**: Download packages from any remote location, including external package registries or other Artifactory instances

<Callout icon="📘" theme="info">
  **Note**

  Swift remote repositories support private Swift registries, including Smart Remote repositories, and the public Tuist Swift Package Registry at `https://tuist.dev/api/registry/swift`.
</Callout>

* **Virtual repositories**: Aggregate remote and local repositories, enabling your organization to scale by providing a single URL that provides access to multiple repositories and types

For more information on JFrog repositories, see [Repository Management](/docs/repository-management).

**Prerequisite**: You need Admin or Project Admin permissions in Artifactory to create a repository. If you don't have Admin permissions, the option will not be available.

**To create a Swift repository**:

1. In the **Administration** tab, click **Repositories** > **Create a Repository**.

   ![CreateAnsibleLocal1.png](https://files.readme.io/689c36e9b67613873cac1a2e1a72ec4c529d081cfc5af182976e1f30ab854f45-uuid-45c813d9-16f6-c9f7-d1a1-4a86a4b1d6dd.png)

2. Select the type of repository you want to create: local, remote, or virtual.

3. Select the **Swift** package type.

4. Configure the required fields for the repository:

   * For local repositories, in the **Repository Key** field, enter a meaningful name for the repository. For example, `swift-local`. For more information on local repositories and their settings, see <Anchor target="_blank" href="/artifactory/docs/local-repositories">Local Repositories</Anchor>.
   * For remote repositories, verify the **Repository URL** and update as needed. For more information on remote repositories and their settings, see <Anchor target="_blank" href="/artifactory/docs/remote-repositories">Remote Repositories</Anchor>.

     Swift remote repositories connect to registries that use the Swift registry protocol, including the public Tuist Swift Package Registry at `https://tuist.dev/api/registry/swift`. URLs like <Anchor target="_blank" href="https://swiftpackageregistry.com/"><https://swiftpackageregistry.com></Anchor> are HTML catalogs that do not host any packages, but point to GitHub repositories that host packages.
   * For virtual repositories, select one or more local or remote repository types to include in the virtual repository. For more information on virtual repositories and their settings, see <Anchor target="_blank" href="/artifactory/docs/virtual-repositories">Virtual Repositories</Anchor>.

5. Click **Create Repository**. The repository is created and the Repositories page is displayed.

## Connect Swift to Artifactory

Configure your Swift client to connect to your Artifactory repositories. You can configure repositories per Swift project or globally.

Swift uses HTTPS by default. If you need to connect using HTTP, open the `.swiftpm/configuration/registries.json` file and update the scheme in the `"url"` field to `http`.

**Prerequisite**: Before connecting your Swift client to Artifactory, you must have an existing Swift repository in Artifactory. For more information, see [Create a Swift Repository](#create-a-swift-repository).

**To connect the Swift client to Artifactory:**

1. From your Swift project directory, run the following command to add the Artifactory repository to your Swift configuration:

   ```shell
   swift package-registry set "https://<JFROG_PLATFORM_URL>/artifactory/api/swift/<REPO_NAME>"
   ```

   <Callout icon="✅" theme="okay">
     **Tip**

     To configure the registry for all Swift projects, add the `--global` flag before the registry URL. You can run the `--global` command from any directory.
   </Callout>

   Where:

   * `<JFROG_PLATFORM_URL>`: The URL of your JFrog Platform
   * `<REPO_NAME>`: The name of the target repository in Artifactory

   For example:

   ```shell
   swift package-registry set "https://company.jfrog.io/artifactory/api/swift/swift-virtual"
   ```

   The `.swiftpm/configuration/registries.json` file is created.

2. Add the following snippet with your Artifactory authentication information to your `~/.netrc` file:

   ```text
   machine <JFROG_PLATFORM_URL> login <USERNAME> password <AUTH_TOKEN>
   ```

   Where:

   * `<JFROG_PLATFORM_URL>`: The base URL of your JFrog Platform
   * `<USERNAME>`: Your Artifactory username
   * `<AUTH_TOKEN>`: Your Artifactory identity token

   For example:

   ```text
   machine company.jfrog.io login jeffry password B7r9P2tLqGvXzWcM5jN3yHkF6sD8aA1vS4uK0eI2oZp7xTqWcE5rVbN1mKjHgF
   ```

   <Callout icon="📘" theme="info">
     **Note**

     You can also use JFrog Set Me Up to copy the snippet populated with your token and environment. For more information, see [Use Artifactory Set Me Up for Configuring Package Manager Clients](/artifactory/docs/use-artifactory-set-me-up-for-configuring-package-manager-clients).

   </Callout>

<br />

**Next steps:**

* [Deploy Swift Packages](#deploy-swift-packages "Deploy Swift Packages")
* [Resolve Swift Packages](#resolve-swift-packages "Resolve Swift Packages")

### Connect to a Specific Swift Repository

Connect directly to a specific Swift repository in Artifactory and bypass any project-specific or global configurations.

**To connect to a specific Swift repository:**

1. Run the following command:

   ```shell
   swift package-registry login https://<JFROG_PLATFORM_URL>/artifactory/api/swift/<REPO_NAME> \
       --username <USERNAME> \
       --password <AUTH>
   ```

   Where:

   * `<JFROG_PLATFORM_URL>`: The URL of your JFrog Platform
   * `<REPO_NAME>`: The name of the target Artifactory repository
   * `<USERNAME>`: Your Artifactory username
   * `<AUTH>`: Your Artifactory identity token or password. For more information about using a password securely, see [Centrally Secure Passwords](/administration/docs/centrally-secure-passwords)

   For example:

   ```shell
   swift package-registry login https://company.jfrog.io/artifactory/api/swift/swift-virtual \
       --username jeffry \
       --password B7r9P2tLqGvXzWcM5jN3yHkF6sD8aA1vS4uK0eI2oZp7xTqWcE5rVbN1mKjHgF
   ```

## Deploy Swift Packages

Deploy Swift packages to an Artifactory Swift repository after you connect your client.

<Callout icon="📘" theme="info">
  **Note**

  Swift packages must be deployed according to the following structure, or they won't be indexed:

  * `<SCOPE>/<NAME>/<NAME>-<VERSION>.zip`
  * `<SCOPE>/<NAME>/<VERSION>`
</Callout>

**To deploy Swift packages:**

1. From the root directory of the package, run this command to create a source archive for the working tree:

   ```shell
   swift package archive-source
   ```

2. Publish the archive using one of the following commands, based on your version of the Swift client:

   * **Version 5.9 or later**:

     ```shell
     swift package-registry publish <SCOPE>.<NAME> <VERSION>
     ```

     Where:

     * `<SCOPE>`: The owner or namespace of the package, usually the scope of the source code repository URL
     * `<NAME>`: The name of the project as defined in the `Package.swift` file
     * `<VERSION>`: The version of the package, usually corresponding with a tag in the source code repository

     For example:

     ```shell
     swift package-registry publish aurora-fi.aurora-auth-ios 2.1.4
     ```
   * **Version 5.8 or earlier**:

     ```shell
     curl -X PUT -u<USERNAME>:<AUTH> \
     -H "Accept: application/vnd.swift.registry.v1+json" \
     -F source-archive="@<SOURCE_ARCHIVE_PATH>" \
     https://<JFROG_PLATFORM_URL>/artifactory/api/swift/<REPO_NAME>/<SCOPE>/<NAME>/<VERSION>
     ```

     Where:

     * `<USERNAME>`: Your Artifactory username
     * `<AUTH>`: Your Artifactory identity token or secure password
     * `<SOURCE_ARCHIVE_PATH>`: The local file path to the source archive for the package
     * `<JFROG_PLATFORM_URL>`: The URL of your JFrog Platform
     * `<REPO_NAME>`: The name of the target repository in Artifactory
     * `<SCOPE>`: The owner or namespace of the package, usually the scope of the source code repository URL
     * `<NAME>`: The name of the project as defined in the `Package.swift` file
     * `<VERSION>`: The version of the package, usually corresponding with a tag in the source code repository

     For example:

     ```shell
     curl -X PUT -ujeffry:B7r9P2tLqGvXzWcM5jN3yHkF6sD8aA1vS4uK0eI2oZp7xTqWcE5rVbN1mKjHgF \
     -H "Accept: application/vnd.swift.registry.v1+json" \
     -F source-archive="@/opt/build/agent/work/aurora-auth-ios-2.1.4.zip" \
     https://company.jfrog.io/artifactory/api/swift/swift-releases/aurora-fi/aurora-auth-ios/2.1.4
     ```

<Callout icon="📘" theme="info">
  **Note**

  You can also use JFrog Set Me Up to copy the snippet populated with your token and environment. For more information, see [Use Artifactory Set Me Up for Configuring Package Manager Clients](/artifactory/docs/use-artifactory-set-me-up-for-configuring-package-manager-clients).

</Callout>

<br />

## Resolve Swift Packages

Resolve Swift package dependencies from an Artifactory Swift repository using the Swift Package Manager client.

**To resolve Swift packages:**

1. List all dependencies in the `Package.swift` file for the package you want to resolve:

   ```swift
   dependencies: [
   .package(id: "<SCOPE>.<NAME>", from:"<VERSION>")
   ]
   ```

   Where:

   * `<SCOPE>`: The owner or namespace of the package, usually the scope of the source code repository URL
   * `<NAME>`: The name of the project as defined in the `Package.swift` file
   * `<VERSION>`: The version of the package, usually corresponding with a tag in the source code repository

   For example:

   ```swift
   dependencies: [
       .package(id: "apple.swift-nio", from: "2.65.0"),
       .package(id: "vapor.fluent", from: "4.8.0"),
       .package(id: "pointfreeco.swift-composable-architecture", from: "1.10.0"),
       .package(id: "google.swift-protobuf", from: "1.27.0")
   ]
   ```

2. Run one of the following commands based on the repository type you configured in [Connect Swift to Artifactory](#connect-swift-to-artifactory):

   * **Local repositories**:

     ```shell
     swift package resolve
     ```

   * **Remote and virtual repositories**:

     ```shell
     swift package --replace-scm-with-registry resolve
     ```

     Starting with Swift 5.9, Swift Package Manager defaults to resolving package dependencies from Git. The `--replace-scm-with-registry` flag directs Swift Package Manager to resolve dependencies from the configured registry instead of Git. This flag is required when resolving packages from remote or virtual repositories that proxy a Swift registry, such as the Tuist registry.

   <Callout icon="📘" theme="info">
     **Note**

     Xcode does not automatically replace source control packages with their registry equivalents. Direct registry dependencies declared with `.package(id:from:)` resolve through the registry, but transitive dependencies declared as `url:` are still resolved from Git. To resolve through Artifactory, manually remove the source control dependency and add the equivalent registry dependency in `Package.swift`. The `--replace-scm-with-registry` flag applies to the SwiftPM CLI only, not to Xcode.
   </Callout>

<Callout icon="📘" theme="info">
  **Note**

  You can also use JFrog Set Me Up to copy the snippet populated with your token and environment. For more information, see [Use Artifactory Set Me Up for Configuring Package Manager Clients](/artifactory/docs/use-artifactory-set-me-up-for-configuring-package-manager-clients).

</Callout>

<br />

## Additional Swift Information

The following pages provide additional information about using Swift with Artifactory:

* [Re-Index a Swift Repository](#re-index-a-swift-repository "Re-Index a Swift Repository")
* [Swift Repository Structure](#swift-repository-structure "Swift Repository Structure")

### Re-Index a Swift Repository

You can trigger an asynchronous re-indexing of a local Swift repository either through the UI or using the REST API.

This reindexes the git index and, as a result, will also index the remote repositories.

**Prerequisite**: You need Admin or Project Admin permissions in Artifactory to re-index a repository.

**To re-index a Swift repository through the UI:**

1. In the **Platform** module, go to **Artifactory** > **Artifacts**.
2. Find your repository in the repository tree. For more information, see [Search for Artifacts on SaaS](/docs/search-for-artifacts).
3. Right-click the repository and select **Recalculate Index**.

**Re-index a Swift repository through the REST API:**

You can also reindex Swift repositories using the [Calculate Swift Index REST API](/reference/calculateswiftindex).

### Swift Repository Structure

The Swift package structure is as follows.

```text
`├── Package.swift ├── README.md ├── Sources`

`│ └─ Hello`  `│ └── hello.swift └── Tests`  `└─ HelloTests └── helloTests.swift └─ LinuxMain.swift`
```

#### Swift Deployment Structure

All deployments of Swift packages into Artifactory can be deployed under the following structures:

* `<SCOPE>/<NAME>/<NAME>-<VERSION>.zip` structure.
* `<SCOPE>/<NAME>/<VERSION>`: Based on the following <Anchor target="_blank" href="https://github.com/apple/swift-package-manager/">Swift Publish API</Anchor>.

Packages must be deployed according to this structure, or they won't be included in the index file.

## Swift Limitations in Artifactory

The following are the limitations of Swift in Artifactory:

* **Supported versions**: Using Swift with JFrog Artifactory requires Swift version 5.7 and above, and JFrog Artifactory 7.41.4 and above.
* **Authentication support**: Swift 5.8 and above requires at least JFrog Artifactory 7.55.1 for proper authentication support.
* **Xcode registry resolution**: Xcode does not automatically replace source control (`url:`) package dependencies with registry (`id:`) equivalents. You must manually update dependencies in `Package.swift` to use registry IDs where you want Artifactory resolution.
* **Deployment structure**: Swift packages must be deployed in the following structure to be indexed properly in Artifactory:

  * `<SCOPE>/<NAME>/<NAME>-<VERSION>.zip`
  * `<SCOPE>/<NAME>/<VERSION>`

## Frequently Asked Questions

This section provides answers to frequently asked questions about using Swift repositories with JFrog Artifactory.

<Accordion title="FAQs" icon="plus">
  ##### Q: How do I connect Swift Package Manager to JFrog Artifactory?

  **A:** Run `swift package-registry set` with your Artifactory Swift registry URL, then add your credentials to `~/.netrc`. See [Connect Swift to Artifactory](#connect-swift-to-artifactory).

  ##### Q: Which resolve command do I use for local versus remote Swift repositories?

  **A:** Use `swift package resolve` for local repositories. For remote or virtual repositories, use `swift package --replace-scm-with-registry resolve`. See [Resolve Swift Packages](#resolve-swift-packages).

  ##### Q: Why do packages still resolve from Git in Xcode after I configure the registry?

  **A:** Xcode does not automatically replace source control (`url:`) dependencies with registry (`id:`) equivalents. Update `Package.swift` to use registry IDs for dependencies you want to resolve through Artifactory. The `--replace-scm-with-registry` flag applies to the SwiftPM CLI only. See [Resolve Swift Packages](#resolve-swift-packages).

  ##### Q: Does JFrog Artifactory support the Tuist Swift Package Registry?

  **A:** Yes. Create a Swift remote repository and set the registry URL to `https://tuist.dev/api/registry/swift`. See [Create a Swift Repository](#create-a-swift-repository).

  ##### Q: What Swift and Artifactory versions are required?

  **A:** JFrog Artifactory requires Swift 5.7 or later and Artifactory 7.41.4 or later. Swift 5.8 authentication requires Artifactory 7.55.1 or later. See [Swift Limitations in Artifactory](#swift-limitations-in-artifactory).

  ##### Q: Why must Swift packages follow a specific folder structure when deploying?

  **A:** Artifactory indexes packages only when they are deployed under `<SCOPE>/<NAME>/<NAME>-<VERSION>.zip` or `<SCOPE>/<NAME>/<VERSION>`. See [Deploy Swift Packages](#deploy-swift-packages).
</Accordion>

## Related Topics

* [Connect Your Package Manager to Artifactory](/docs/connect-your-package-manager-to-artifactory)
* [Use Artifactory Set Me Up for Configuring Package Manager Clients](/docs/use-artifactory-set-me-up-for-configuring-package-manager-clients)
* [Local Repositories](/docs/local-repositories)
* [Remote Repositories](/docs/remote-repositories)
* [Virtual Repositories](/docs/virtual-repositories)