Swift Package Manager distribution for the Bolt iOS SDK — a native checkout, payment, and account authentication SDK for iOS.
Minimum deployment target: iOS 16 Swift: 5.9+
- In Xcode, go to File → Add Package Dependencies
- Enter the repository URL:
https://github.com/BoltApp/bolt-ios-checkout-sdk - Select the version rule (e.g. Up to Next Major from
0.1.0) - Add BoltCheckoutSDK to your app target
dependencies: [
.package(url: "https://github.com/BoltApp/bolt-ios-checkout-sdk", from: "0.1.0")
],
targets: [
.target(
name: "YourApp",
dependencies: ["BoltCheckoutSDK"]
)
]Import the SDK in any file:
import BoltCheckoutSDKSet your publishable key and environment before using any SDK feature. The publishable key is available in Merchant Dashboard → Developers → API.
Bolt.ClientProperties.shared.environment = .production
Bolt.ClientProperties.shared.publishableKey = "your-publishable-key"Register Bolt fonts if you use any UI components:
Bolt.UI.registerFonts()Use the .boltAuthorize() view modifier:
@State private var isAuthorizing = false
var body: some View {
Button("Sign in with Bolt") {
isAuthorizing = true
}
.boltAuthorize(
isAuthorizing: $isAuthorizing,
email: "user@example.com",
context: .checkout,
onAccountCheck: { accountExists in
// Called when account existence check completes
},
completion: { result in
switch result {
case .completed(let authorizationCode, let codeVerifier):
// Exchange auth code for access token via OAuthToken endpoint
case .canceled:
break
case .failed(let error):
// Handle error
}
}
)
}Bolt.Login.startAuthorization(
email: "user@example.com",
parentViewController: self,
context: .checkout,
onAccountCheck: { accountExists in
// Called when account existence check completes
},
completion: { result in
switch result {
case .completed(let authorizationCode, let codeVerifier):
// Exchange auth code for access token via OAuthToken endpoint
case .canceled:
break
case .failed(let error):
// Handle error
}
}
)Check whether a user has a Bolt account before showing a login prompt:
Bolt.Account.detectAccount(email: "user@example.com") { result in
switch result {
case .success(let hasAccount):
if hasAccount {
// Show Bolt login option
}
case .failure(let error):
// Handle error
}
}Securely tokenize credit card details:
let tokenizer = Bolt.CreditCardTokenizer()
tokenizer.generateToken(cardNumber: "4111111111111111", cvv: "123") { result in
switch result {
case .success(let token):
// Use token.token, token.last4, token.bin, token.network, token.tokenExpiry
case .failure(let error):
// Handle error
}
}The SDK provides pre-built UI components available in both SwiftUI and UIKit.
// Sign-in button
Bolt.UI.SignInButton(context: .checkout) {
// Handle button tap — start authorization flow
}
// Account creation checkbox
Bolt.UI.AccountCheckbox(
merchantName: "My Store",
isChecked: true,
onCheckboxTap: { isChecked in },
onLinkTap: { url in }
)
// Email info button
Bolt.UI.EmailInfoButton { url in
// Handle link tap
}
// Signed-in status button
Bolt.UI.SignedInStatusButton { url in
// Handle link tap
}// Sign-in button
let signInVC = Bolt.UI.SignInButtonViewController(context: .checkout)
signInVC.delegate = self
// Account checkbox
let checkboxVC = Bolt.UI.AccountCheckboxViewController(merchantName: "My Store", isChecked: true)
checkboxVC.delegate = self
// Email info button
let emailInfoVC = Bolt.UI.EmailInfoButtonViewController()
emailInfoVC.delegate = self
// Signed-in status button
let statusVC = Bolt.UI.SignedInStatusButtonViewController()
statusVC.delegate = selfLog checkout events for analytics:
// Set common properties (e.g. session info)
Bolt.Analytics.setCommonProperties(["sessionId": "abc123"])
// Log an event
Bolt.Analytics.log(.checkoutButtonTapped)
Bolt.Analytics.log(.paymentMethodSelected(.creditCard), ["additional": "value"])The SDK uses the camera for credit card scanning. Add this key to your app's Info.plist:
<key>NSCameraUsageDescription</key>
<string>Your camera is used to automatically scan credit card info.</string>Full integration guide, configuration options, and API reference: BoltApp/bolt-ios-managed-checkout-sdk