Installation
In Xcode: File → Add Package Dependencies, paste this URL:
https://github.com/scalekit-inc/scalekit-sdk-iosSet version rule to from: "0.3.0", select your app target, then click Add Package.
0.3.0 Swift SPM iOS 15+
In Xcode: File → Add Package Dependencies, paste this URL:
https://github.com/scalekit-inc/scalekit-sdk-iosSet version rule to from: "0.3.0", select your app target, then click Add Package.
import ScalekitAuth
@StateObject private var client = ScalekitClient( environmentURL: "YOUR_ENV_URL", // e.g. acme.scalekit.cloud clientId: "YOUR_CLIENT_ID", // starts with ntvc_ redirectScheme: "YOUR_BUNDLE_ID" // e.g. com.example.myapp)// Basic logintry await client.login()
// With organization routing (SSO)try await client.login(options: .init(organizationId: "org_123456"))
// Access user informationif let user = client.credentials?.userInfo { print(user.name) // "Jane Doe" print(user.email) // "jane@acme.com"}
// Refresh the access token before protected API calls (no-op if still valid)try await client.renew()let accessToken = client.credentials?.accessToken
// Logoutawait client.logout()