SDKs/Swift
phone_iphone Official SDK · iOS · watchOS · macOS
Coming Soon

WorkoutX Swift SDK

The official Swift package for the WorkoutX API. Build fitness apps for iOS, watchOS, iPadOS, and macOS with native async/await — 1,400+ exercises with GIF animations, the AI Workout Generator, supplements, and the Body Scan API. Built on URLSession, no third-party dependencies.

.package(url: "https://github.com/workoutx/sdk-swift", from: "0.1.0")

📦 Publishing to GitHub shortly — not yet available. Get your key now and you'll be ready the moment it lands.

Quick start

One client covers both products — the Exercise API (API-key auth) and the Body Scan API (user JWT). The SDK attaches the right credential automatically.

import WorkoutX let wx = WorkoutX(apiKey: "wx_your_key_here", scan: .token("eyJ...")) // Exercises let page = try await wx.exercises.list(limit: 20) let lunges = try await wx.exercises.byName("lunges") let similar = try await wx.exercises.similar("0001") // Exercise GIF (Data) or a ready URL for AsyncImage let data = try await wx.gifs.get("0001") let src = wx.gifURL("0001") // AI Workout Generator let workout = try await wx.workout.generate(["goal": "hypertrophy", "days": 4]) // Body Scan let credits = try await wx.scan.credits()
bolt

Native async/await

Modern concurrency built on URLSession. Strongly-typed Exercise models and a flexible JSON type for everything else.

shield

Resilient by default

Automatic retries with backoff on 429 and 5xx, honoring Retry-After. Structured WorkoutXError with status, code and tips.

dataset

Both products, one client

Exercises, GIFs, workouts, supplements and Body Scan — all under wx.*. Auth handled transparently per product.

Look up an exercise by name or ID — safely

Exercise IDs are not sequential, so passing a human name to get() returns a 404. The find() helper tries an ID first, then falls back to a name search.

let ex = try await wx.exercises.find("lunges") // Exercise?

Frequently asked questions

How do I install the WorkoutX Swift SDK?

Add the Swift Package https://github.com/workoutx/sdk-swift in Xcode (File ▸ Add Packages) or to your Package.swift dependencies, then add the WorkoutX product to your target.

Which platforms are supported?

iOS 13+, macOS 10.15+, watchOS 6+, and tvOS 13+. It uses native async/await and URLSession, with no third-party dependencies.

How do I show an exercise GIF in SwiftUI?

Use wx.gifURL("0001") to build a direct URL and pass it to AsyncImage, or fetch raw bytes with wx.gifs.get().

How does authentication work for the Body Scan API?

Body Scan uses a logged-in user's JWT. Pass scan: .token("..."), or scan: .credentials(email:password:) to let the SDK log in automatically.

Security & API keys

vpn_key

Keys are visible in apps

Anything bundled in an iOS app can be extracted. For production, route requests through your own backend or use a restricted, rotatable key rather than embedding a full-access key.

image

GIF URLs carry the key

gifURL() puts the key in the query string so AsyncImage can load it. Since URLs can leak via logs and referrers, use a separate, restricted key for GIFs where possible.

lock

Use tokens, not credentials

For Body Scan, fetch a short-lived JWT from your backend and pass scan: .token(...). Avoid shipping the email/password login flow inside the app.

Start building for iOS

Free tier included. 1,400+ exercises, GIFs, workouts, and Body Scan in one Swift package.

Get your free API key