Prerequisites
Prerequisites
Before you begin, make sure you have:
- iOS 13.0+ - The SDK requires iOS 13.0 or later
- Swift 5.9+ - Modern Swift features are used throughout
- Xcode 15.0+ - For the best development experience
- Dynamic Account - Set up your project and get an environment ID from Dynamic Dashboard
Install the SDK
Configure Environment Variables
The SDK needs to know which Dynamic environment to connect to. You’ll need to set up environment variables in your Xcode scheme:- In Xcode, go to Product → Scheme → Edit Scheme
- Select “Run” from the left sidebar
- Go to the “Arguments” tab
- Under “Environment Variables”, add the following:
<your_environment_id>
with the environment ID from your Dynamic dashboard.
Configure URL Scheme
Add a URL scheme to yourInfo.plist
for social authentication callbacks:
Info.plist
Initialize the SDK
Complete Initialization Example
Here’s a complete example showing how to initialize the SDK with session state management and Ethereum connector:Enable Features in Dashboard
Before you can use authentication and wallet features, you need to enable them in your Dynamic dashboard:- Go to your Dynamic Dashboard
- Select your project
- Go to Authentication and enable the methods you want to use:
- Email OTP
- SMS OTP
- Social providers (Apple, Google, etc.)
- Go to Wallets and enable embedded wallets
- Go to Chains and enable the networks you want to support
For testing, we recommend starting with Email OTP authentication and Ethereum
Sepolia testnet. This gives you a complete setup without requiring real phone
numbers or mainnet transactions.
Troubleshooting
Common Issues
-
Could not find module ‘DynamicSwiftSDK’
- Make sure you’ve added the package to your target
- Try cleaning the build folder (Product → Clean Build Folder)
- Restart Xcode
-
Environment ID not found
- Check that you’ve set the
DYNAMIC_ENVIRONMENT_ID
environment variable - Verify the environment ID in your Dynamic dashboard
- Make sure you’re using the correct environment (sandbox vs live)
- Check that you’ve set the
-
Network connection failed
- Check your internet connection
- Verify the
DYNAMIC_BASE_URL
andDYNAMIC_RELAY_HOST
environment variables - Ensure your environment is active in the Dynamic dashboard
-
Session state not updating
- Make sure you’re calling
bindSessionState(sessionState, to: client)
after creating the client - Verify that your UI is observing the
DynamicSessionState
object
- Make sure you’re calling
What’s Next
Great! Your SDK is now configured and ready to use. Here’s what you can do next:- Authentication Guide - Learn how to implement user authentication with email and SMS OTP
- Social Authentication - Add social login options like Apple and Google
- Wallet Creation - Create and manage embedded wallets for your users
- Networks - Configure blockchain networks
📱 Complete Example App: For a fully functional iOS app demonstrating all
SDK features, check out our Swift Example
Repository. It includes
authentication flows, wallet management, and Ethereum transaction examples
with SwiftUI.