Install with Swift Package Manager in Xcode using:
https://github.com/putdotio/putio-sdk-swift.git
Or add it to Package.swift:
dependencies: [
.package(url: "https://github.com/putdotio/putio-sdk-swift.git", from: "1.0.0")
]Then depend on the PutioSDK product.
Import it as:
import PutioSDKIf you use CocoaPods today, install with:
pod 'PutioSDK'import PutioSDK
let sdk = PutioSDK(
config: PutioSDKConfig(
clientID: "<your-client-id>",
token: "<your-access-token>"
)
)
Task {
do {
let account = try await sdk.getAccountInfo()
print(account.username)
} catch let error as PutioSDKError {
print(error.message)
print(error.recoverySuggestion ?? "")
}
}The SDK exposes an async-first async throws surface with native URLSession transport and no third-party networking dependency. It no longer ships completion-handler compatibility wrappers or raw JSON response APIs.
Apps that need a custom transport for tests, fixtures, or specialized session configuration can pass their own URLSession:
let configuration = URLSessionConfiguration.ephemeral
configuration.protocolClasses = [MockURLProtocol.self]
let sdk = PutioSDK(
config: PutioSDKConfig(clientID: "<your-client-id>"),
urlSession: URLSession(configuration: configuration)
)Thrown SDK errors are PutioSDKError values that conform to LocalizedError and expose small classification helpers for app code:
do {
_ = try await sdk.getFile(fileID: 42)
} catch let error as PutioSDKError {
if error.isAuthenticationFailure {
// refresh credentials or send the user through sign-in
} else if error.isRetryable {
// schedule a retry with backoff
} else if error.matches(statusCode: 404) {
// refresh stale local state
}
}For local development, the repo exposes one verification command:
make verifyUse Contributing for setup, deterministic verification, live API checks, and release expectations.
The example app shows a minimal ASWebAuthenticationSession flow and a follow-up account fetch:
- Example app for the example app and smoke-test workspace
- Architecture for the current async transport and decoding direction
- Testing for deterministic and live verification
- Readiness for the current verification confidence
- Security for private vulnerability reporting
- Agent guide for repo-specific agent guidance
Start with Contributing so local setup, verification, and release expectations stay aligned with CI
This project is available under the MIT License
