Prerequisites
Prerequisites
Before you begin, make sure you have:
- iOS 15.0+ - The SDK requires iOS 15.0 or later
- Swift 5.9+ - Modern Swift features are used throughout
- Xcode 14.0+ - For the best development experience
- Dynamic Account - Set up your project and get an environment ID from Dynamic Dashboard
Install the SDK
Configure URL Scheme
Add a URL scheme to yourInfo.plist for authentication callbacks:
Info.plist
Initialize the SDK
Configuration Options
| Property | Description | Required |
|---|---|---|
environmentId | Your Dynamic environment ID from the dashboard | Yes |
appLogoUrl | URL to your app’s logo (shown in auth UI) | Yes |
appName | Your app’s display name | Yes |
redirectUrl | Deep link URL scheme for callbacks | Yes |
appOrigin | Your app’s origin URL | Yes |
logLevel | Logging level (.debug, .info, .warn, .error) | No |
debug | Debug options like ClientDebugProps(webview: true) | No |
Access the SDK
After initialization, access the SDK singleton anywhere in your app:Basic Usage
Using Built-in Authentication UI
The easiest way to add authentication is using the built-in UI:Listening for Authentication State
Use Combine publishers to react to authentication changes:Complete Example with Wallets
Enable Features in Dashboard
Before you can use authentication and wallet features, 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, Farcaster)
- Passkeys
- Go to Wallets and enable embedded wallets
- Go to Chains and enable the networks you want to support (EVM and/or Solana)
Troubleshooting
Common Issues
-
Could not find module ‘DynamicSDKSwift’
- Make sure you’ve added the package to your target
- Try cleaning the build folder (Product → Clean Build Folder)
- Restart Xcode
-
SDK not initialized
- Ensure
DynamicSDK.initialize()is called in your App’sinit()before any views access the SDK - Don’t call
DynamicSDK.instance()before initialization
- Ensure
-
Authentication callbacks not working
- Verify your URL scheme is configured in
Info.plist - Ensure the
redirectUrlmatches your URL scheme - Whitelist your deep link URL in the Dynamic dashboard under Security → Whitelist Mobile Deeplink
- Verify your URL scheme is configured in
-
Wallets not appearing after login
- Wallets are created asynchronously after authentication
- Use
sdk.wallets.userWalletsChangespublisher to listen for wallet updates - Check that embedded wallets are enabled in your dashboard
-
Session state not updating
- Make sure you’re observing the reactive Combine publishers (
authenticatedUserChanges,userWalletsChanges, etc.) - Verify that your views are using
@StateObjector@ObservedObjectfor view models that observe SDK state
- Make sure you’re observing the reactive Combine publishers (
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, SMS, and passkeys
- Social Authentication - Add social login options like Apple, Google, and Farcaster
- Wallet Operations - Work with balances and sign messages
- Networks - Configure blockchain networks
📱 Complete Example App: For a fully functional iOS app demonstrating all SDK
features, check out our Swift SDK Example App. It
includes authentication flows (email/SMS OTP, social login, passkeys), wallet management, EVM/Solana transactions,
MFA, and passkey examples with SwiftUI.