Skip to main content

Classes

Adrop

The main class of the SDK. Manages SDK initialization and global settings.

Static Methods

MethodReturn TypeDescription
initialize(production:useInAppBrowser:targetCountries:)voidInitialize SDK
setUID(_:)voidSet user identifier
setTheme(_:)voidSet app theme
handleDeepLink(url:)BoolHandle deep link
openQuest(channel:path:)voidOpen Quest screen

Static Properties

PropertyTypeDescription
sdkVersionStringSDK version (read-only)

Initialize Method

static func initialize(
    production: String,
    useInAppBrowser: Bool = true,
    targetCountries: [String]? = nil
)
production
String
required
Production key issued from the Ad Control console
useInAppBrowser
Bool
default:"true"
Whether to use in-app browser. If true, ad clicks open within the app
targetCountries
[String]?
default:"nil"
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)
uid
String
required
Unique ID to identify the user (max 100 characters)
Usage Example:
Adrop.setUID("user_12345")

Set Theme

static func setTheme(_ theme: AdropTheme)
theme
AdropTheme
required
App theme (light, dark, auto)
Usage Example:
Adrop.setTheme(.dark)

AdropBanner

Class for displaying banner ads. Inherits from UIView.

Initialization

init(unitId: String)
unitId
String
required
Banner ad unit ID created in the Ad Control console

Methods

MethodReturn TypeDescription
load()voidRequest and load ad

Properties

PropertyTypeDescription
unitIdStringUnit ID (read-only)
contextIdString?Contextual targeting ID (read/write)
creativeSizeCGSize?Ad creative size (read-only)
destinationURLString?Ad destination URL (read-only)
delegateAdropBannerDelegate?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

init(unitId: String)
unitId
String
required
Native ad unit ID created in the Ad Control console

Methods

MethodReturn TypeDescription
load()voidRequest and load ad

Properties

PropertyTypeDescription
headlineString?Ad headline (read-only)
bodyString?Ad body text (read-only)
callToActionString?CTA button text (read-only)
assetString?Main image URL (read-only)
profileAdropProfile?Advertiser profile (read-only)
extra[String: String]?Additional text fields (read-only)
contextIdString?Contextual targeting ID (read/write)
delegateAdropNativeAdDelegate?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

init(unitId: String)
unitId
String
required
Interstitial ad unit ID created in the Ad Control console

Methods

MethodReturn TypeDescription
load()voidPreload ad
show(fromRootViewController:)voidDisplay ad
show Method
func show(fromRootViewController viewController: UIViewController)
viewController
UIViewController
required
Root view controller to present the ad from

Properties

PropertyTypeDescription
delegateAdropInterstitialAdDelegate?Delegate (read/write)
isLoadedBoolWhether ad is loaded (read-only)
contextIdString?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

init(unitId: String)
unitId
String
required
Rewarded ad unit ID created in the Ad Control console

Methods

MethodReturn TypeDescription
load()voidPreload ad
show(fromRootViewController:userDidEarnRewardHandler:)voidDisplay ad and set reward handler
show Method
func show(
    fromRootViewController viewController: UIViewController,
    userDidEarnRewardHandler: @escaping () -> Void
)
viewController
UIViewController
required
Root view controller to present the ad from
userDidEarnRewardHandler
() -> Void
required
Closure called when user earns a reward

Properties

PropertyTypeDescription
delegateAdropRewardedAdDelegate?Delegate (read/write)
isLoadedBoolWhether ad is loaded (read-only)
contextIdString?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
    }
}

AdropPopupAd

Class for displaying popup ads.

Initialization

init(unitId: String)
unitId
String
required
Popup ad unit ID created in the Ad Control console

Methods

MethodReturn TypeDescription
load()voidPreload ad
show(fromRootViewController:)voidDisplay ad
show Method
func show(fromRootViewController viewController: UIViewController)
viewController
UIViewController
required
Root view controller to present the ad from

Properties

PropertyTypeDescription
delegateAdropPopupAdDelegate?Ad event delegate (read/write)
closeDelegateAdropPopupAdCloseDelegate?Close event delegate (read/write)
isLoadedBoolWhether ad is loaded (read-only)
contextIdString?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

init(unitId: String)
unitId
String
required
Splash ad unit ID created in the Ad Control console

Methods

MethodReturn TypeDescription
load()voidPreload ad

AdropSplashAdViewController

View controller for displaying splash ads in full screen.

Initialization

init(unitId: String, backgroundColor: UIColor? = nil)
unitId
String
required
Splash ad unit ID created in the Ad Control console
backgroundColor
UIColor?
default:"nil"
Background color

Properties

PropertyTypeDescription
delegateAdropSplashAdDelegate?Delegate (read/write)
displayDurationTimeIntervalAd display duration (default: 5 seconds, read/write)
logoImageUIImage?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

init(unitId: String)
unitId
String
required
Splash ad unit ID created in the Ad Control console

Methods

MethodReturn TypeDescription
load()voidRequest and load ad

Properties

PropertyTypeDescription
delegateAdropSplashAdDelegate?Delegate (read/write)

AdropMetrics

Class for managing user properties and events.

Static Methods

MethodReturn TypeDescription
setProperty(key:value:)voidSet user property
logEvent(name:params:)voidLog custom event

Set User Property

static func setProperty(key: String, value: Any)
key
String
required
Property key (max 40 characters)
value
Any
required
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)
name
String
required
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.

AdropPopupAdDelegate

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.

AdropPopupAdCloseDelegate

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.
enum AdropErrorCode: Int
CaseCode ValueDescription
ERROR_CODE_NETWORK1000Network error
ERROR_CODE_INTERNAL2000Internal error
ERROR_CODE_INITIALIZE3000SDK initialization failed
ERROR_CODE_INVALID_UNIT4000Invalid unit ID
ERROR_CODE_NOT_TARGET_COUNTRY4010Not a target country
ERROR_CODE_AD_INACTIVE4100No active campaigns
ERROR_CODE_AD_NO_FILL4200No ads available to display
ERROR_CODE_AD_LOAD_DUPLICATED5000Duplicate ad load request
ERROR_CODE_AD_LOADING5001Ad is loading
ERROR_CODE_AD_EMPTY5002Ad not loaded
ERROR_CODE_AD_SHOWN5003Ad already shown
ERROR_CODE_AD_HIDE_FOR_TODAY5100”Don’t show today” is set
ERROR_CODE_ACCOUNT_USAGE_LIMIT_EXCEEDED6000Account usage limit exceeded
ERROR_CODE_LANDSCAPE_UNSUPPORTED7000Landscape mode not supported
ERROR_CODE_AD_BACKFILL_NO_FILL8000No 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.
enum AdropTheme
CaseDescription
lightLight mode
darkDark mode
autoFollow 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