# Update a Sparkle application

This guide connects Sparkle in your macOS application to Seatify. At the end, Sparkle finds a new release, downloads it and installs it. Seatify applies the licensing rules of the product to each check.

## Before you start

- A [product](../../../concepts/products/) with a published release that has a macOS file, such as a `.zip` of your application. See [Publish a release](../../releases/publish-a-release/).
- Your application uses Sparkle 2. Your public EdDSA key is `SUPublicEDKey` in its `Info.plist`. The `generate_keys` tool of Sparkle creates the key pair. See the [Sparkle documentation](https://sparkle-project.org/documentation/).
- For a product with the `licensed` [distribution](../../../concepts/products/#distribution) setting, your application stores the license key. See [Add your application](../../licensing/add-your-application/). An `open` product does not need a license key.

## Steps

{{% steps %}}

### Add the feed URL

Copy the Sparkle address from the Distribution tab of the product in the dashboard. Set it as `SUFeedURL` in `Info.plist`:

```xml
<key>SUFeedURL</key>
<string>https://dist.seatify.dev/v1/products/<product id>/appcast.xml?platform=darwin</string>
```

The feed holds the newest stable release that the license can install. Sparkle compares that release with your application.

- If a release has more than one macOS file, such as a `.zip` and a `.dmg`, add `&filetype=zip`.
- If a release has one file for each architecture, add `&arch=arm64` or `&arch=amd64` to each build of your application. A `universal` file serves every Mac.

### Send the license key

Skip this step for an `open` product.

Send the license key in the `Seatify-License-Key` header. Sparkle sends the same headers when it downloads the file, so the download needs no other code.

```swift
import Sparkle

let updaterController = SPUStandardUpdaterController(
    startingUpdater: false,
    updaterDelegate: nil,
    userDriverDelegate: nil
)

updaterController.updater.httpHeaders = ["Seatify-License-Key": licenseKey]
updaterController.startUpdater()
```

### Set the build

Sparkle compares the build of a release with the `CFBundleVersion` of your application. Set the [build](../../../concepts/releases-and-artifacts/#release-properties) of each release to the `CFBundleVersion` of its file, such as `1400`.

Without a build, Sparkle compares the version of the release, such as `1.4.0`. Your `CFBundleVersion` must then be the same version.

A prerelease, such as `1.5.0-beta.1`, needs a build. Sparkle ignores the part of a version after the dash. So `1.5.0-beta.1` and `1.5.0` are the same version to Sparkle.

### Sign and upload the file

Sign the file with the `sign_update` tool of Sparkle:

```bash
./bin/sign_update MyApp-1.4.0.zip
```

The tool prints one line, such as `sparkle:edSignature="…" length="…"`. Upload the file to the release. Paste the line into the [vendor signature](../../../concepts/releases-and-artifacts/#artifact-properties) of the file in the dashboard. The dashboard keeps only the signature. It warns you when the length does not match the file.

Sparkle installs only a file that has a vendor signature. Seatify does not check the vendor signature. Sparkle checks it with `SUPublicEDKey`.

Then publish the release.

### Test the feed

```bash
curl "https://dist.seatify.dev/v1/products/$PRODUCT_ID/appcast.xml?platform=darwin" \
  -H "Seatify-License-Key: $LICENSE_KEY"
```

The feed holds the newest release and its file:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
  <channel>
    <title>Beacon Studio</title>
    <item>
      <title>1.4.0</title>
      <pubDate>Sun, 20 Sep 2026 23:00:00 +0000</pubDate>
      <sparkle:version>1400</sparkle:version>
      <sparkle:shortVersionString>1.4.0</sparkle:shortVersionString>
      <description sparkle:format="plain-text">Updates through Sparkle.</description>
      <enclosure url="https://dist.seatify.dev/v1/products/<product id>/releases/1.4.0/artifacts/BEACON-1.4.0.zip"
                 length="53" type="application/octet-stream" sparkle:os="macos"
                 sparkle:edSignature="<the signature from sign_update>"></enclosure>
    </item>
  </channel>
</rss>
```

`sparkle:version` is the build of the release, and `sparkle:shortVersionString` is its version. `url` is a download address of the Distribution API. It needs the license key too.

A feed without an `<item>` tells Sparkle that no update exists.

{{% /steps %}}

## Handle the answer

Sparkle reads a feed only from an answer with the status 200. For any other status, Sparkle stops the check and calls `updater(_:didAbortWithError:)` of your updater delegate. Sparkle shows an alert only when the user started the check.

| Status | Cause | What to do |
| --- | --- | --- |
| 200 | The feed has an item for the newest release, or no item. | No action is needed. Sparkle compares the build and offers a newer release. |
| 400 | The query is not valid, such as a platform other than `darwin` or `windows`. | Correct `SUFeedURL`. |
| 401 | The license key is missing on a `licensed` product, or the key is not valid. | Ask the user for a valid key. |
| 403 | Seatify refused the license, for example because it has expired or is suspended. | Call [Validate](../../../license-api/licenses/validate/) to learn the reason and show it to the user. |
| 404 | Several files of the release match, the file has no vendor signature, or a prerelease has no build. | Correct the release. The message of the answer names the problem. |
| 429 | Your application sent too many requests. | Try again later. |

A license that has expired under the [After expiry](../../../concepts/policies/#after-expiry) rule that keeps access to older releases is not refused. Its feed holds the newest release that it covers.

## Send the running version

Without a version, the feed holds the newest stable release. Send the version of your application, and the feed follows its channel. The feed then leaves out releases at or below that version. Sparkle adds the version to the feed URL through your updater delegate:

```swift
final class UpdaterDelegate: NSObject, SPUUpdaterDelegate {
    func feedParameters(for updater: SPUUpdater, sendingSystemProfile: Bool) -> [[String: String]] {
        let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? ""
        return [["key": "version", "value": version, "displayKey": "Version", "displayValue": version]]
    }
}
```

The version is the semantic version, such as `1.4.0` or `1.5.0-beta.1`. It is not the build.

## Beta and version lines

The feed stays in the channel of the version that your application sends. Without a version, it offers only stable releases. See [Channels](../../../concepts/releases-and-artifacts/#channels).

- Add `&channel=beta` to the feed URL to offer beta releases.
- Add `&constraint=2` to keep your application on version 2. See [Newest release](../../../concepts/releases-and-artifacts/#newest-release).

The feed has no `sparkle:channel` element. The URL chooses the channel. To let the user choose, return the URL from `feedURLString(for:)` of your updater delegate:

```swift
func feedURLString(for updater: SPUUpdater) -> String? {
    let channel = UserDefaults.standard.bool(forKey: "JoinBeta") ? "beta" : "stable"
    return "https://dist.seatify.dev/v1/products/\(productID)/appcast.xml?platform=darwin&channel=\(channel)"
}
```

## Next steps

- [Update a WinSparkle application](../winsparkle-updates/)
- [Publish a release](../../releases/publish-a-release/)
- [Updates and download links](../../releases/updates-and-download-links/)
- [Releases and artifacts](../../../concepts/releases-and-artifacts/)
- [Validate a license](../../../license-api/licenses/validate/)

