Ad Quality iOS SDK Swift Integration
Ad Quality supports both Objective-C and Swift. While the SDK is written in Objective-C, you can easily make it compatible with Swift.
Step 1: Bridging Header
Swift and Objective-C use different runtime environments, you need a bridging header to access Objective-C code in Swift.
Note:
We plan to roll out an updated SDK that will simplify your integration and remove the need of adding a bridging header manually.
Once this change is live we’ll update you on our SDK Change log.
We plan to roll out an updated SDK that will simplify your integration and remove the need of adding a bridging header manually.
Once this change is live we’ll update you on our SDK Change log.
-
- Create a Bridging Header
- Inside Xcode – Go to File → New → File.
- Select Header File under Source.
- Name it Ad-Quality-Bridging-Header.h and save it in your project.
- Link the Header in Build Settings
- Import the Objective-C SDK into the Bridging Header
Inside Ad-Quality-Bridging-Header.h, import the Objective-C SDK’s main header file:
#import "IronSourceAdQuality.h"
- Create a Bridging Header
Step 2: Use the SDK in Swift
You can now use the Objective-C classes inside your Swift files.
For example:
import SwiftUI
@main
struct ironsourceadquality_sampleApp: App {
init() {
IronSourceAdQuality.getInstance().initialize(withAppKey: "YOUR_APP_KEY")
}
}
Done!
What’s Next?
You are now all set to start integrating the Ad Quality SDK with Swift!
Continue to Integrate Ad Quality SDK for iOS.