How do I integrate an exercise API in a native iOS (Swift) app?
In a native iOS app, call WorkoutDB with URLSession, sending your key in an X-API-Key header. Decode the JSON envelope into Codable structs and play the returned mp4 with AVPlayer — no third-party SDK required.
The Swift integration
WorkoutDB is standard REST, so URLSession plus Codable is all you need. Define structs that mirror the { data, meta, requestId } envelope and the exercise fields, send a GET with the X-API-Key header, and decode. Keep the key out of the binary by proxying through your backend or fetching it from a secure config rather than hard-coding it.
For demonstrations, hand the returned mp4 URL to AVPlayer; for a quick looping preview, load the GIF. The media streams over a CDN, so playback is smooth on device. The published OpenAPI 3.1 spec can also generate a Swift client if you prefer.
- URLSession + Codable — no native SDK to add.
- X-API-Key header; keep the key off the device where possible.
- AVPlayer for mp4, GIF for lightweight loops, all over a CDN.
- OpenAPI 3.1 spec available for client generation.
Related questions
- Is there a Swift SDK?
- There is no Swift package, but the API is plain REST/JSON and integrates cleanly with URLSession and Codable. The OpenAPI 3.1 spec lets you generate a Swift client if you want one.
- How do I play the videos on iOS?
- Pass the returned mp4 URL to AVPlayer. The media is served over a CDN, so it streams natively without extra dependencies.
Build it on WorkoutDB
~873 exercises with demo video, ranked search, and four languages — over a clean REST API. Start free: 5,000 requests/month, no credit card.