Introduction
The Magify Swift SDK enables you to integrate analytics, purchases tracking, campaign delivery, remote configuration, and content management into your iOS application.
The SDK is designed to provide a lightweight and native integration experience for Swift-based applications while remaining flexible enough for custom runtime behavior and advanced application architectures.
Before you begin
Before integrating the SDK, make sure your project meets the following requirements:
- iOS 15.0 or later
- Xcode 15 or later
- Swift 5.9 or later
You will also need access to the Magify Dashboard in order to download your application configuration file.
Architecture overview
The main entry point of the SDK is the MagifyClient object.
MagifyClient is responsible for:
- loading SDK configuration;
- managing client identity;
- synchronizing application state;
- tracking subscriptions and purchases;
- updating runtime content and features;
- communicating with Magify backend services.
The SDK is designed around a single shared client instance that lives throughout the application lifecycle.
Recommended integration approach
We recommend creating and managing a single shared MagifyClient instance during application startup.
Usually, the SDK is initialized inside the application delegate:
import UIKit
import Magify
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
lazy var magify: MagifyClient = {
let configURL = Bundle.main.url(
forResource: "Magify-Config",
withExtension: "json"
)!
let magify = MagifyClient(
for: "MyApplication",
defaultConfigURL: configURL,
isSandbox: false
)
return magify
}()
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
magify.setup()
return true
}
}
This approach helps avoid conflicts caused by creating multiple client instances.
Next step
Now that you understand the SDK architecture, you can proceed to the Installation section to add the Magify Swift SDK to your project.