Ad Quality supports both Objective-C and Swift. While the SDK is written in Objective-C, you can 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.
- 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
- Open Project Navigator and select your project target.
- Go to Build Settings.
- Search for Objective-C Bridging Header.
- Set the path to the bridging header:
YourApp/Ad-Quality-Bridging-Header.h
- 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"
- Inside Ad-Quality-Bridging-Header.h, import the Objective-C SDK's main header file:
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") } }
You can now start integrating the Ad Quality SDK with Swift. Continue to Integrate Ad Quality SDK for iOS.