AlphaSDK is the official Swift client for the Alpha Camera REST API. It uses URLSession only (zero third-party dependencies) and exposes Swift concurrency throughout.
- SwiftPM:
https://github.com/jordlee/alpha-sdk-swift.git - Latest:
0.3.1 - Platforms: iOS 15+, macOS 12+, tvOS 15+, watchOS 8+
- Swift: 5.7+
- SDK repo + macOS sample app:
alpha-sdk-swift
Install
Add to yourPackage.swift dependencies:
AlphaSDK to your target’s dependencies:
from 0.3.1.
You also need a server reachable from the device. The Swift client does not ship a ServerManager class — start the server using the Node-based CLI from the server package, or, on macOS, spawn the bundled binary from your application using Process (recipe). iOS applications typically connect over the local network to a server running on a Mac, Raspberry Pi, or similar host.
Initialize
Constructor options
AlphaSDKClient is Sendable and safe to share across actors.
Common operations
List + connect a camera
Read a single property
Read every property at once
Set a property
Trigger the shutter
Pull a single live-view JPEG
try await client.liveView.enableOsd(cameraId: cameraId):
Disconnect
Error handling
Every method throwsAlphaSDKError, an enum with cases for transport
failures and HTTP responses. Pattern-match the case (or, for HTTP responses,
classify with HTTPError.kind):
HTTPError exposes statusCode, parsed body (with message / code / type),
and kind (.notFound, .validation, .client, .server, …). All other
failure modes are dedicated cases on AlphaSDKError itself
(.timeout, .networkError, .decodingError, …).
Advanced
Custom request headers per call
Cancellation
Swift’s structured concurrency does the right thing — wrap the call in aTask and cancel:
Bring your own URLSession
Useful for proxying, intercepting, or testing:What’s NOT in the client
By design, the following live in recipes rather than the generated SDK:- SSE events — use
URLSession.bytes(for:)to stream/api/eventsand parsetext/event-streamline-by-line. See the SSE events recipe. - Discovery + reconnect orchestration — copy from the discovery + reconnect recipe.
Versioning
AlphaSDK follows SemVer. Every release is git-tagged on the SwiftPM repository — see the CHANGELOG there for release notes.
