Swift
Installation Guide
Prerequisites
- iOS 13.0+
- Swift 5.9+
- Xcode 15.0+
- Dynamic account and environment ID: Set up your project and get an environment ID from https://app.dynamic.xyz/dashboard/overview
Swift Package Manager
Option 1: Package.swift
Add the following to your Package.swift
file:
Option 2: Xcode
- File → Add Package Dependencies
- Enter the repository URL:
https://github.com/dynamic-labs/sdk-swift.git
- Select version
0.0.4
orfrom: 0.0.4
- Add to your target
Setup in App
1. Configure Environment Variables
Add the following environment variables to your app scheme:
- In Xcode, go to Product → Scheme → Edit Scheme
- Select “Run” from the left sidebar
- Go to the “Arguments” tab
- Under “Environment Variables”, add:
Use the environment ID from your Dynamic dashboard (see Prerequisites above).
2. Initialize the SDK
Import and configure the SDK in your Swift files: