Classes
Adrop
The main class of the SDK. Manages SDK initialization and global settings.
Static Methods
| Method | Return Type | Description |
|---|
initialize(production:useInAppBrowser:targetCountries:) | void | Initialize SDK |
setUID(_:) | void | Set user identifier |
setTheme(_:) | void | Set app theme |
handleDeepLink(url:) | Bool | Handle deep link |
openQuest(channel:path:) | void | Open Quest screen |
Static Properties
| Property | Type | Description |
|---|
sdkVersion | String | SDK version (read-only) |
Initialize Method
static func initialize(
production: String,
useInAppBrowser: Bool = true,
targetCountries: [String]? = nil
)
Production key issued from the Ad Control console
Whether to use in-app browser. If true, ad clicks open within the app
Array of target country codes (e.g., [“KR”, “US”]). nil for all countries
Usage Example:
// AppDelegate.swift
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
Adrop.initialize(production: "YOUR_PRODUCTION_KEY")
return true
}
Set User Identifier
static func setUID(_ uid: String)
Unique ID to identify the user (max 100 characters)
Usage Example:
Adrop.setUID("user_12345")
Set Theme
static func setTheme(_ theme: AdropTheme)
App theme (light, dark, auto)
Usage Example:
AdropBanner
Class for displaying banner ads. Inherits from UIView.
Initialization
Banner ad unit ID created in the Ad Control console
Methods
| Method | Return Type | Description |
|---|
load() | void | Request and load ad |
Properties
| Property | Type | Description |
|---|
unitId | String | Unit ID (read-only) |
contextId | String? | Contextual targeting ID (read/write) |
creativeSize | CGSize? | Ad creative size (read-only) |
destinationURL | String? | Ad destination URL (read-only) |
delegate | AdropBannerDelegate? | Delegate (read/write) |
Usage Example:
let banner = AdropBanner(unitId: "YOUR_UNIT_ID")
banner.contextId = "article_123"
banner.delegate = self
banner.load()
AdropNativeAd
Class for managing native ad data.
Initialization
Native ad unit ID created in the Ad Control console
Methods
| Method | Return Type | Description |
|---|
load() | void | Request and load ad |
Properties
| Property | Type | Description |
|---|
headline | String? | Ad headline (read-only) |
body | String? | Ad body text (read-only) |
callToAction | String? | CTA button text (read-only) |
asset | String? | Main image URL (read-only) |
profile | AdropProfile? | Advertiser profile (read-only) |
extra | [String: String]? | Additional text fields (read-only) |
contextId | String? | Contextual targeting ID (read/write) |
delegate | AdropNativeAdDelegate? | Delegate (read/write) |
Usage Example:
let nativeAd = AdropNativeAd(unitId: "YOUR_UNIT_ID")
nativeAd.delegate = self
nativeAd.load()
// After ad loads
titleLabel.text = nativeAd.headline
bodyLabel.text = nativeAd.body
ctaButton.setTitle(nativeAd.callToAction, for: .normal)
AdropInterstitialAd
Class for displaying interstitial ads.
Initialization
Interstitial ad unit ID created in the Ad Control console
Methods
| Method | Return Type | Description |
|---|
load() | void | Preload ad |
show(fromRootViewController:) | void | Display ad |
show Method
func show(fromRootViewController viewController: UIViewController)
Root view controller to present the ad from
Properties
| Property | Type | Description |
|---|
delegate | AdropInterstitialAdDelegate? | Delegate (read/write) |
isLoaded | Bool | Whether ad is loaded (read-only) |
contextId | String? | Contextual targeting ID (read/write) |
Usage Example:
let interstitial = AdropInterstitialAd(unitId: "YOUR_UNIT_ID")
interstitial.delegate = self
interstitial.load()
// After ad loads
if interstitial.isLoaded {
interstitial.show(fromRootViewController: self)
}
AdropRewardedAd
Class for displaying rewarded ads.
Initialization
Rewarded ad unit ID created in the Ad Control console
Methods
| Method | Return Type | Description |
|---|
load() | void | Preload ad |
show(fromRootViewController:userDidEarnRewardHandler:) | void | Display ad and set reward handler |
show Method
func show(
fromRootViewController viewController: UIViewController,
userDidEarnRewardHandler: @escaping () -> Void
)
Root view controller to present the ad from
Closure called when user earns a reward
Properties
| Property | Type | Description |
|---|
delegate | AdropRewardedAdDelegate? | Delegate (read/write) |
isLoaded | Bool | Whether ad is loaded (read-only) |
contextId | String? | Contextual targeting ID (read/write) |
Usage Example:
let rewardedAd = AdropRewardedAd(unitId: "YOUR_UNIT_ID")
rewardedAd.delegate = self
rewardedAd.load()
// After ad loads
if rewardedAd.isLoaded {
rewardedAd.show(fromRootViewController: self) {
print("User earned a reward!")
// Grant reward logic
}
}
Class for displaying popup ads.
Initialization
Popup ad unit ID created in the Ad Control console
Methods
| Method | Return Type | Description |
|---|
load() | void | Preload ad |
show(fromRootViewController:) | void | Display ad |
show Method
func show(fromRootViewController viewController: UIViewController)
Root view controller to present the ad from
Properties
| Property | Type | Description |
|---|
delegate | AdropPopupAdDelegate? | Ad event delegate (read/write) |
closeDelegate | AdropPopupAdCloseDelegate? | Close event delegate (read/write) |
isLoaded | Bool | Whether ad is loaded (read-only) |
contextId | String? | Contextual targeting ID (read/write) |
Usage Example:
let popupAd = AdropPopupAd(unitId: "YOUR_UNIT_ID")
popupAd.delegate = self
popupAd.closeDelegate = self
popupAd.load()
// After ad loads
if popupAd.isLoaded {
popupAd.show(fromRootViewController: self)
}
AdropSplashAd
Class for managing splash ads.
Initialization
Splash ad unit ID created in the Ad Control console
Methods
| Method | Return Type | Description |
|---|
load() | void | Preload ad |
AdropSplashAdViewController
View controller for displaying splash ads in full screen.
Initialization
init(unitId: String, backgroundColor: UIColor? = nil)
Splash ad unit ID created in the Ad Control console
Properties
| Property | Type | Description |
|---|
delegate | AdropSplashAdDelegate? | Delegate (read/write) |
displayDuration | TimeInterval | Ad display duration (default: 5 seconds, read/write) |
logoImage | UIImage? | Logo image to display at bottom (read/write) |
Usage Example:
let splashVC = AdropSplashAdViewController(unitId: "YOUR_UNIT_ID")
splashVC.delegate = self
splashVC.displayDuration = 3.0 // Display for 3 seconds
splashVC.logoImage = UIImage(named: "app_logo") // Set logo image
splashVC.modalPresentationStyle = .fullScreen
present(splashVC, animated: false)
AdropSplashAdView
View for displaying splash ads. Inherits from UIView.
Initialization
Splash ad unit ID created in the Ad Control console
Methods
| Method | Return Type | Description |
|---|
load() | void | Request and load ad |
Properties
| Property | Type | Description |
|---|
delegate | AdropSplashAdDelegate? | Delegate (read/write) |
AdropMetrics
Class for managing user properties and events.
Static Methods
| Method | Return Type | Description |
|---|
setProperty(key:value:) | void | Set user property |
logEvent(name:params:) | void | Log custom event |
Set User Property
static func setProperty(key: String, value: Any)
Property key (max 40 characters)
Property value (supports String, Int, Double, Bool)
Usage Example:
AdropMetrics.setProperty(key: "age", value: 25)
AdropMetrics.setProperty(key: "gender", value: "male")
AdropMetrics.setProperty(key: "isPremium", value: true)
Log Event
static func logEvent(name: String, params: [String: Any]? = nil)
Event name (max 40 characters)
params
[String: Any]?
default:"nil"
Event parameters (max 25)
Usage Example:
AdropMetrics.logEvent(name: "purchase_completed", params: [
"item_id": "product_123",
"amount": 9.99,
"currency": "USD"
])
Protocols (Delegates)
AdropBannerDelegate
Protocol for handling banner ad lifecycle events.
Required Methods
func onAdReceived(_ banner: AdropBanner)
Called when ad is received successfully.
func onAdFailedToReceive(_ banner: AdropBanner, _ errorCode: AdropErrorCode)
Called when ad fails to receive.
Optional Methods
optional func onAdImpression(_ banner: AdropBanner)
Called when ad is displayed on screen.
optional func onAdClicked(_ banner: AdropBanner)
Called when user clicks the ad.
Implementation Example:
extension ViewController: AdropBannerDelegate {
func onAdReceived(_ banner: AdropBanner) {
print("Banner ad received")
}
func onAdFailedToReceive(_ banner: AdropBanner, _ errorCode: AdropErrorCode) {
print("Banner ad failed: \(errorCode)")
}
func onAdImpression(_ banner: AdropBanner) {
print("Banner ad impression")
}
func onAdClicked(_ banner: AdropBanner) {
print("Banner ad clicked")
}
}
AdropNativeAdDelegate
Protocol for handling native ad lifecycle events.
Required Methods
func onAdReceived(_ nativeAd: AdropNativeAd)
Called when ad is received successfully.
func onAdFailedToReceive(_ nativeAd: AdropNativeAd, _ errorCode: AdropErrorCode)
Called when ad fails to receive.
Optional Methods
optional func onAdImpression(_ nativeAd: AdropNativeAd)
Called when ad is displayed on screen.
optional func onAdClicked(_ nativeAd: AdropNativeAd)
Called when user clicks the ad.
AdropInterstitialAdDelegate
Protocol for handling interstitial ad lifecycle events.
Required Methods
func onAdReceived(_ ad: AdropInterstitialAd)
Called when ad is received successfully.
func onAdFailedToReceive(_ ad: AdropInterstitialAd, _ errorCode: AdropErrorCode)
Called when ad fails to receive.
func onAdFailedToShow(_ ad: AdropInterstitialAd, _ errorCode: AdropErrorCode)
Called when ad fails to show.
Optional Methods
optional func onAdImpression(_ ad: AdropInterstitialAd)
Called when ad is displayed on screen.
optional func onAdClicked(_ ad: AdropInterstitialAd)
Called when user clicks the ad.
optional func onAdDidDismissFullScreenContent(_ ad: AdropInterstitialAd)
Called when ad is closed.
AdropRewardedAdDelegate
Protocol for handling rewarded ad lifecycle events.
Required Methods
func onAdReceived(_ ad: AdropRewardedAd)
Called when ad is received successfully.
func onAdFailedToReceive(_ ad: AdropRewardedAd, _ errorCode: AdropErrorCode)
Called when ad fails to receive.
func onAdFailedToShow(_ ad: AdropRewardedAd, _ errorCode: AdropErrorCode)
Called when ad fails to show.
Optional Methods
optional func onAdImpression(_ ad: AdropRewardedAd)
Called when ad is displayed on screen.
optional func onAdClicked(_ ad: AdropRewardedAd)
Called when user clicks the ad.
optional func onAdDidDismissFullScreenContent(_ ad: AdropRewardedAd)
Called when ad is closed.
Protocol for handling popup ad lifecycle events.
Required Methods
func onAdReceived(_ ad: AdropPopupAd)
Called when ad is received successfully.
func onAdFailedToReceive(_ ad: AdropPopupAd, _ errorCode: AdropErrorCode)
Called when ad fails to receive.
func onAdFailedToShow(_ ad: AdropPopupAd, _ errorCode: AdropErrorCode)
Called when ad fails to show.
Optional Methods
optional func onAdImpression(_ ad: AdropPopupAd)
Called when ad is displayed on screen.
optional func onAdClicked(_ ad: AdropPopupAd)
Called when user clicks the ad.
optional func onAdDidDismissFullScreenContent(_ ad: AdropPopupAd)
Called when ad is closed.
Protocol for handling popup ad close events.
Optional Methods
optional func onAdHidedForToday(_ ad: AdropPopupAd)
Called when user selects “Don’t show today”.
optional func onAdClosed(_ ad: AdropPopupAd)
Called when user closes the ad.
AdropSplashAdDelegate
Protocol for handling splash ad lifecycle events.
Required Methods
func onAdReceived(_ ad: AdropSplashAd)
Called when ad is received successfully.
func onAdFailedToReceive(_ ad: AdropSplashAd, _ errorCode: AdropErrorCode)
Called when ad fails to receive.
Optional Methods
optional func onAdImpression(_ ad: AdropSplashAd)
Called when ad is displayed on screen.
optional func onAdClicked(_ ad: AdropSplashAd)
Called when user clicks the ad.
Enums
AdropErrorCode
Error codes that can occur during ad loading and display.
| Case | Code Value | Description |
|---|
ERROR_CODE_NETWORK | 1000 | Network error |
ERROR_CODE_INTERNAL | 2000 | Internal error |
ERROR_CODE_INITIALIZE | 3000 | SDK initialization failed |
ERROR_CODE_INVALID_UNIT | 4000 | Invalid unit ID |
ERROR_CODE_NOT_TARGET_COUNTRY | 4010 | Not a target country |
ERROR_CODE_AD_INACTIVE | 4100 | No active campaigns |
ERROR_CODE_AD_NO_FILL | 4200 | No ads available to display |
ERROR_CODE_AD_LOAD_DUPLICATED | 5000 | Duplicate ad load request |
ERROR_CODE_AD_LOADING | 5001 | Ad is loading |
ERROR_CODE_AD_EMPTY | 5002 | Ad not loaded |
ERROR_CODE_AD_SHOWN | 5003 | Ad already shown |
ERROR_CODE_AD_HIDE_FOR_TODAY | 5100 | ”Don’t show today” is set |
ERROR_CODE_ACCOUNT_USAGE_LIMIT_EXCEEDED | 6000 | Account usage limit exceeded |
ERROR_CODE_LANDSCAPE_UNSUPPORTED | 7000 | Landscape mode not supported |
ERROR_CODE_AD_BACKFILL_NO_FILL | 8000 | No backfill ads available |
Error Code Descriptions
Network Related
ERROR_CODE_NETWORK: Network connection error occurred. Check internet connection.
Initialization Related
ERROR_CODE_INITIALIZE: SDK is not initialized. Call Adrop.initialize() first.
Unit Related
ERROR_CODE_INVALID_UNIT: Invalid unit ID. Verify in the console.
ERROR_CODE_NOT_TARGET_COUNTRY: Current user’s country is not a target country.
Ad Related
ERROR_CODE_AD_INACTIVE: No active campaigns for this unit.
ERROR_CODE_AD_NO_FILL: No ads available to display.
ERROR_CODE_AD_BACKFILL_NO_FILL: No backfill ads available either.
Ad State Related
ERROR_CODE_AD_LOAD_DUPLICATED: Already loading an ad.
ERROR_CODE_AD_LOADING: Ad is still loading.
ERROR_CODE_AD_EMPTY: Must load ad before displaying.
ERROR_CODE_AD_SHOWN: Ad already shown. Load a new ad.
ERROR_CODE_AD_HIDE_FOR_TODAY: User selected “Don’t show today”.
Other
ERROR_CODE_INTERNAL: Internal error occurred.
ERROR_CODE_ACCOUNT_USAGE_LIMIT_EXCEEDED: Account ad usage limit exceeded.
ERROR_CODE_LANDSCAPE_UNSUPPORTED: This ad does not support landscape mode.
Usage Example:
func onAdFailedToReceive(_ banner: AdropBanner, _ errorCode: AdropErrorCode) {
switch errorCode {
case .ERROR_CODE_NETWORK:
print("Network error: Check your connection")
case .ERROR_CODE_AD_NO_FILL:
print("No ads available to display")
case .ERROR_CODE_INVALID_UNIT:
print("Invalid unit ID")
default:
print("Ad load failed: \(errorCode.rawValue)")
}
}
AdropTheme
Enum representing app theme settings.
| Case | Description |
|---|
light | Light mode |
dark | Dark mode |
auto | Follow system setting (default) |
Usage Example:
// Set light mode
Adrop.setTheme(.light)
// Set dark mode
Adrop.setTheme(.dark)
// Follow system setting
Adrop.setTheme(.auto)
Structs and Types
AdropProfile
Struct containing advertiser profile information.
struct AdropProfile {
let displayLogo: String? // Advertiser logo URL
let displayName: String? // Advertiser name
let link: String? // Advertiser profile link
}
Usage Example:
if let profile = nativeAd.profile {
profileNameLabel.text = profile.displayName
if let logoURL = profile.displayLogo {
// Load logo image
loadImage(from: logoURL, into: profileImageView)
}
}
Constants
AdropUnitId
Test unit ID constants.
struct AdropUnitId {
// Banner ads
static let PUBLIC_TEST_UNIT_ID_320_50: String
static let PUBLIC_TEST_UNIT_ID_320_100: String
static let PUBLIC_TEST_UNIT_ID_CAROUSEL: String
static let PUBLIC_TEST_UNIT_ID_BANNER_VIDEO_16_9: String
static let PUBLIC_TEST_UNIT_ID_BANNER_VIDEO_9_16: String
// Native ads
static let PUBLIC_TEST_UNIT_ID_NATIVE_SMALL: String
static let PUBLIC_TEST_UNIT_ID_NATIVE_MEDIUM: String
static let PUBLIC_TEST_UNIT_ID_NATIVE_LARGE: String
// Interstitial ads
static let PUBLIC_TEST_UNIT_ID_INTERSTITIAL: String
// Rewarded ads
static let PUBLIC_TEST_UNIT_ID_REWARDED: String
// Popup ads
static let PUBLIC_TEST_UNIT_ID_POPUP: String
static let PUBLIC_TEST_UNIT_ID_POPUP_BOTTOM: String
static let PUBLIC_TEST_UNIT_ID_POPUP_CENTER: String
static let PUBLIC_TEST_UNIT_ID_POPUP_BOTTOM_VIDEO_9_16: String
static let PUBLIC_TEST_UNIT_ID_POPUP_CENTER_VIDEO_9_16: String
// Splash ads
static let PUBLIC_TEST_UNIT_ID_SPLASH: String
}
Usage Example:
let banner = AdropBanner(unitId: AdropUnitId.PUBLIC_TEST_UNIT_ID_320_100)
let carouselBanner = AdropBanner(unitId: AdropUnitId.PUBLIC_TEST_UNIT_ID_CAROUSEL)
let nativeAd = AdropNativeAd(unitId: AdropUnitId.PUBLIC_TEST_UNIT_ID_NATIVE_SMALL)
let interstitial = AdropInterstitialAd(unitId: AdropUnitId.PUBLIC_TEST_UNIT_ID_INTERSTITIAL)
let popup = AdropPopupAd(unitId: AdropUnitId.PUBLIC_TEST_UNIT_ID_POPUP_CENTER)
Use test unit IDs only in development environments. You must use actual unit IDs created in the console for production.
Additional Resources