Swift SDK for iOS App

Official vrtx SDK for integrating with iOS applications using Swift.

Installation

Add the vrtx SDK to your iOS project using Swift Package Manager or CocoaPods:

Swift Package Manager

swift
dependencies: [
    .package(url: "https://github.com/vrtx/vrtx-swift-sdk.git", from: "1.0.0")
]

CocoaPods

ruby
pod 'VRTXSDK', '~> 1.0'

Initialization

swift
import VRTXSDK

let client = VRTXClient(
    clientId: "your-client-id",
    clientSecret: "your-client-secret",
    environment: .sandbox  // or .production
)

// Get access token
let token = try await client.auth.getToken()
print("Access token: \(token.accessToken)")

Mapping to REST

SDK CallREST EndpointPurpose
client.auth.getToken()POST /auth/tokenExchange credentials for access token
client.wallets.get()GET /customers/{customer_id}/walletGet wallet details for a customer
client.cards.issue()POST /cards/issueIssue a virtual or physical card

Error Handling

swift
do {
  let wallet = try await client.wallets.get(
    customerId: "c1d2e3f4-a5b6-7890-c1d2-e3f4a5b6c7d8"
  )
  print("Wallet account ID: \(wallet.accountId)")
} catch {
  // Inspect error codes and retry when appropriate
  print("Request failed: \(error)")
}

Refer to the Errors reference to map SDK exceptions to API error codes.