Installation
Follow these steps to add the Magify Swift SDK to your project.
Requirements
Before installing the SDK, make sure your environment meets the following requirements:
- iOS 15.0 or later
- Xcode 15 or later
- Swift 5.9 or later
Downloading Magify SDK
Download the latest SDK archive and unzip it locally.

After extracting the archive, you should see the SDK folder that contains the Swift package files.
Adding the package
Open your Xcode project and launch Swift Package Manager:
File > Add Packages...
Then press:
Add Local...

Select the unzipped SDK folder and press:
Add Package

Wait until Xcode resolves the package and installs it into your project.
Adding package to the target
After the package is resolved, add the SDK package to your application target.
Make sure the Magify library is selected for your app target before confirming the installation.

Setup Magify SDK
The SDK requires a Magify-Config.json configuration file generated in the Magify Dashboard.
Download the configuration file and add it to your Xcode project.
Make sure the file is included in your application target.

SDK initialization
Set up the MagifyClient object carefully, ensuring that your application uses a single shared SDK instance during the application lifecycle.
This helps avoid conflicts or unexpected behavior caused by creating multiple client instances.
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
)
// Optional flags.
magify.isGeoIPEnabled = true
magify.isLoggingEnabled = true
return magify
}()
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
magify.setup()
return true
}
func sceneDidBecomeActive(_ scene: UIScene) {
magify.update()
}
}
Verifying installation
Once the SDK is initialized successfully:
- the package should compile without errors;
- the configuration file should load correctly;
magify.setup()should complete during application launch;magify.update()should be called when the application becomes active.
If logging is enabled, you can additionally verify SDK activity through the Xcode console.
Dummy configuration example
If you need a temporary configuration file for local testing, you can use the following example:
{
"limits": {
"impression_per_session_limit": null,
"interstitials_per_session_limit": null,
"sessions_interval": null,
"global_interval": null,
"interstitial_interval": null,
"required_campaign_types": []
},
"native_elements": [],
"campaigns": [],
"features": {},
"content": {}
}
Integration checklist
- Add the
Magify-Config.jsonfile to your Xcode target. - Initialize the SDK during application launch.
- Call
magify.setup(). - Call
magify.update()whenever the application becomes active. - Verify that the SDK initializes successfully without runtime errors.
Next step
Now that the SDK is installed and initialized, you can proceed to the Configuration section to customize the SDK behavior for your application.