Swift (iOS)
Learn how to integrate the Capsule SDK into your iOS Swift applications.
The Capsule SDK for Swift allows you to easily integrate secure and scalable wallet functionalities into your iOS applications. This guide covers the installation, setup, and usage of the Capsule SDK, including handling authentication flows.
Prerequisites
To use Capsule, you need an API key. This key authenticates your requests to Capsule services and is essential for integration.
Don’t have an API key yet? Request access to the Developer Portal to create API keys, manage billing, teams, and more.
Setup
Add Capsule SDK as a Package Dependency
- In your Xcode project, go to Target -> MyApp -> General -> Frameworks, Libraries, and Embedded Content, and click the + symbol to add a new package dependency.
- On the next screen, click Add Other -> Add Package Dependency.
- Enter
https://github.com/capsule-org/swift-sdk
into the search field and select the dependency rule Up to Next Major Version. Ensure the range is0.0.1 < 1.0.0
.
- Add the package to the project MyApp.
- Ensure Add to Target has MyApp selected, and then click Add Package.
Initialize the Capsule SDK
Import the Capsule package and initialize it in your app.
Capsule offers two hosted environments: Environment.BETA
(alias Environment.DEVELOPMENT
) for
testing, and Environment.PROD
(alias Environment.PRODUCTION
) for live use. Select the
environment that matches your current development phase.
Implement User and Wallet Creation
Enable User Login
Examples
To help you get started with the Capsule Swift SDK, we’ve prepared a comprehensive example:
This example repository demonstrates how to handle user authentication, wallet creation, and signing messages using the Capsule SDK in a SwiftUI iOS application. It will help you understand how to seamlessly integrate Capsule into your project.
Next Steps
After integrating Capsule, you can explore other features and integrations to enhance your Capsule experience. Here are some resources to help you get started:
Ecosystems
Learn how to use Capsule with popular Web3 clients and wallet connectors. We’ll cover integration with key libraries for EVM, Solana, and Cosmos ecosystems.
If you’re ready to go live with your Capsule integration, make sure to review our go-live checklist:
Support
If you’re experiencing issues that aren’t resolved by our troubleshooting resources, please contact our support team for assistance. To help us serve you better, include the following information in your support request:
1
A detailed description of the problem you’re encountering.
2
Any relevant error messages or logs.
3
Steps to reproduce the issue.
4
Details about your system or environment (e.g., device, operating system, software version).
Providing this information will enable our team to address your concerns more efficiently.
Was this page helpful?