> ## Documentation Index
> Fetch the complete documentation index at: https://docs.adrop.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Reference

> Classes, protocols, enums, and type definitions for the Adrop iOS SDK.

## 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:)`                                | `@discardableResult Bool` | Open Quest screen                     |
| `registerWebView(_:)`                                     | `void`                    | Register a WKWebView for backfill ads |

#### Static Properties

| Property         | Type                   | Description                                                                        |
| ---------------- | ---------------------- | ---------------------------------------------------------------------------------- |
| `sdkVersion`     | `String`               | SDK version (read-only)                                                            |
| `consentManager` | `AdropConsentManager?` | Consent manager (automatically set when AdropAdsBackfill is installed, read/write) |

#### Initialize Method

```swift theme={null}
static func initialize(
    production: Bool = false,
    useInAppBrowser: Bool = false,
    targetCountries: [String]? = nil
)
```

<ParamField body="production" type="Bool" default="false">
  Production mode. Set to `true` when deploying
</ParamField>

<ParamField body="useInAppBrowser" type="Bool" default="false">
  Whether to use in-app browser. If `true`, ad clicks open within the app
</ParamField>

<ParamField body="targetCountries" type="[String]?" default="nil">
  Array of target country codes (e.g., \["KR", "US"]). `nil` for all countries
</ParamField>

**Usage Example:**

```swift theme={null}
// AppDelegate.swift
func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
    Adrop.initialize(production: false)
    return true
}
```

#### Set User Identifier

```swift theme={null}
static func setUID(_ uid: String)
```

<ParamField body="uid" type="String" required>
  Unique ID to identify the user (max 100 characters)
</ParamField>

**Usage Example:**

```swift theme={null}
Adrop.setUID("user_12345")
```

#### Set Theme

```swift theme={null}
static func setTheme(_ theme: AdropTheme)
```

<ParamField body="theme" type="AdropTheme" required>
  App theme (light, dark, auto)
</ParamField>

**Usage Example:**

```swift theme={null}
Adrop.setTheme(.dark)
```

***

### AdropBanner

Class for displaying banner ads. Inherits from `UIView`.

#### Initialization

```swift theme={null}
init(unitId: String, contextId: String = "")
```

<ParamField body="unitId" type="String" required>
  Banner ad unit ID created in the Ad Control Console
</ParamField>

<ParamField body="contextId" type="String">
  Contextual targeting ID (default: empty string)
</ParamField>

#### Methods

| Method                     | Return Type | Description                             |
| -------------------------- | ----------- | --------------------------------------- |
| `load()`                   | `void`      | Request and load ad                     |
| `open(_:useInAppBrowser:)` | `void`      | Open URL (defaults to `destinationURL`) |

#### Static Methods

| Method                              | Return Type | Description                                                                              |
| ----------------------------------- | ----------- | ---------------------------------------------------------------------------------------- |
| `loads(unitId:contextId:delegate:)` | `void`      | Batch load up to 5 banner ads — see [Batch Loading](/sdk/ios/banner#batch-loading-loads) |

#### Static Properties

| Property        | Type  | Description                                                 |
| --------------- | ----- | ----------------------------------------------------------- |
| `maxLoadsBatch` | `Int` | Maximum number of ads returned by `loads(...)` (value: `5`) |

#### Properties

| Property              | Type                                       | Description                                       |
| --------------------- | ------------------------------------------ | ------------------------------------------------- |
| `unitId`              | `String`                                   | Unit ID (read-only)                               |
| `contextId`           | `String`                                   | Contextual targeting ID (read-only, set via init) |
| `creativeSize`        | `CGSize`                                   | Ad creative size (read-only, defaults to zero)    |
| `destinationURL`      | `String?`                                  | Ad destination URL (read-only)                    |
| `txId`                | `String`                                   | Transaction ID (read-only)                        |
| `campaignId`          | `String`                                   | Campaign ID (read-only)                           |
| `creativeId`          | `String`                                   | Creative ID (read-only)                           |
| `isBackfilled`        | `Bool`                                     | Whether the ad is a backfill ad (read-only)       |
| `useCustomClick`      | `Bool`                                     | Whether to use custom click handling (read/write) |
| `browserTarget`       | `BrowserTarget?`                           | How to open URLs on ad click (read-only)          |
| `delegate`            | `AdropBannerDelegate?`                     | Delegate (read/write)                             |
| `onAdReceived`        | `((AdropBanner) -> Void)?`                 | Closure callback for ad received                  |
| `onAdFailedToReceive` | `((AdropBanner, AdropErrorCode) -> Void)?` | Closure callback for ad failed                    |
| `onAdImpression`      | `((AdropBanner) -> Void)?`                 | Closure callback for ad impression                |
| `onAdClicked`         | `((AdropBanner) -> Void)?`                 | Closure callback for ad clicked                   |
| `onAdVideoStart`      | `((AdropBanner) -> Void)?`                 | Closure callback for video start                  |
| `onAdVideoEnd`        | `((AdropBanner) -> Void)?`                 | Closure callback for video end                    |

**Usage Example:**

```swift theme={null}
let banner = AdropBanner(unitId: "YOUR_UNIT_ID", contextId: "article_123")
banner.delegate = self
banner.load()
```

***

### AdropNativeAd

Class for managing native ad data.

#### Initialization

```swift theme={null}
init(unitId: String, contextId: String = "")
```

<ParamField body="unitId" type="String" required>
  Native ad unit ID created in the Ad Control Console
</ParamField>

<ParamField body="contextId" type="String">
  Contextual targeting ID (default: empty string)
</ParamField>

#### Methods

| Method                     | Return Type | Description                             |
| -------------------------- | ----------- | --------------------------------------- |
| `load()`                   | `void`      | Request and load ad                     |
| `open(_:useInAppBrowser:)` | `void`      | Open URL (defaults to `destinationURL`) |

#### Static Methods

| Method                              | Return Type | Description                                                                              |
| ----------------------------------- | ----------- | ---------------------------------------------------------------------------------------- |
| `loads(unitId:contextId:delegate:)` | `void`      | Batch load up to 5 native ads — see [Batch Loading](/sdk/ios/native#batch-loading-loads) |

#### Static Properties

| Property        | Type  | Description                                                 |
| --------------- | ----- | ----------------------------------------------------------- |
| `maxLoadsBatch` | `Int` | Maximum number of ads returned by `loads(...)` (value: `5`) |

#### Properties

| Property                     | Type                                         | Description                                                                         |
| ---------------------------- | -------------------------------------------- | ----------------------------------------------------------------------------------- |
| `unitId`                     | `String`                                     | Unit ID (read-only)                                                                 |
| `contextId`                  | `String`                                     | Contextual targeting ID (read-only, set via init)                                   |
| `txId`                       | `String`                                     | Transaction ID (read-only)                                                          |
| `campaignId`                 | `String`                                     | Campaign ID (read-only)                                                             |
| `creativeId`                 | `String`                                     | Creative ID (read-only)                                                             |
| `isLoaded`                   | `Bool`                                       | Whether ad is loaded (read-only)                                                    |
| `isBackfilled`               | `Bool`                                       | Whether the ad is a backfill ad (read-only)                                         |
| `headline`                   | `String`                                     | Ad headline (read-only)                                                             |
| `body`                       | `String`                                     | Ad body text (read-only)                                                            |
| `callToAction`               | `String`                                     | CTA button text (read-only)                                                         |
| `icon`                       | `String`                                     | Ad icon URL (read-only)                                                             |
| `cover`                      | `String`                                     | Ad cover image URL (read-only)                                                      |
| `asset`                      | `String`                                     | Main image URL (read-only)                                                          |
| `creative`                   | `String`                                     | HTML creative content (read-only)                                                   |
| `advertiser`                 | `String`                                     | Advertiser name (read-only)                                                         |
| `advertiserURL`              | `String`                                     | Advertiser URL (read-only)                                                          |
| `profile`                    | `AdropNativeAdProfile`                       | Advertiser profile (read-only)                                                      |
| `extra`                      | `[String: String]`                           | Additional text fields (read-only)                                                  |
| `accountTag`                 | `[String: Any]`                              | Account tag data (read-only)                                                        |
| `creativeTag`                | `[String: Any]`                              | Creative tag data (read-only)                                                       |
| `creativeSize`               | `CGSize`                                     | Ad creative size (read-only, defaults to zero)                                      |
| `destinationURL`             | `String?`                                    | Ad destination URL (read-only)                                                      |
| `useCustomClick`             | `Bool`                                       | Whether to use custom click handling (read/write)                                   |
| `preferredAdChoicesPosition` | `AdropAdChoicesPosition`                     | AdChoices badge position for backfill native ads (read/write, default: `.topRight`) |
| `browserTarget`              | `BrowserTarget?`                             | How to open URLs on ad click (read-only)                                            |
| `delegate`                   | `AdropNativeAdDelegate?`                     | Delegate (read/write)                                                               |
| `onAdReceived`               | `((AdropNativeAd) -> Void)?`                 | Closure callback for ad received                                                    |
| `onAdFailedToReceive`        | `((AdropNativeAd, AdropErrorCode) -> Void)?` | Closure callback for ad failed                                                      |
| `onAdImpression`             | `((AdropNativeAd) -> Void)?`                 | Closure callback for ad impression                                                  |
| `onAdClicked`                | `((AdropNativeAd) -> Void)?`                 | Closure callback for ad clicked                                                     |
| `onAdVideoStart`             | `((AdropNativeAd) -> Void)?`                 | Closure callback for video start                                                    |
| `onAdVideoEnd`               | `((AdropNativeAd) -> Void)?`                 | Closure callback for video end                                                      |

**Usage Example:**

```swift theme={null}
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

```swift theme={null}
init(unitId: String)
```

<ParamField body="unitId" type="String" required>
  Interstitial ad unit ID created in the Ad Control Console
</ParamField>

#### Methods

| Method                          | Return Type | Description |
| ------------------------------- | ----------- | ----------- |
| `load()`                        | `void`      | Preload ad  |
| `show(fromRootViewController:)` | `void`      | Display ad  |

##### show Method

```swift theme={null}
func show(fromRootViewController viewController: UIViewController)
```

<ParamField body="viewController" type="UIViewController" required>
  Root view controller to present the ad from
</ParamField>

#### Properties

| Property                     | Type                                               | Description                                 |
| ---------------------------- | -------------------------------------------------- | ------------------------------------------- |
| `delegate`                   | `AdropInterstitialAdDelegate?`                     | Delegate (read/write)                       |
| `isLoaded`                   | `Bool`                                             | Whether ad is loaded (read-only)            |
| `unitId`                     | `String`                                           | Unit ID (read-only)                         |
| `txId`                       | `String`                                           | Transaction ID (read-only)                  |
| `campaignId`                 | `String`                                           | Campaign ID (read-only)                     |
| `creativeId`                 | `String`                                           | Creative ID (read-only)                     |
| `isBackfilled`               | `Bool`                                             | Whether the ad is a backfill ad (read-only) |
| `destinationURL`             | `String`                                           | Ad destination URL (read-only)              |
| `browserTarget`              | `BrowserTarget?`                                   | How to open URLs on ad click (read-only)    |
| `onAdReceived`               | `((AdropInterstitialAd) -> Void)?`                 | Closure callback for ad received            |
| `onAdFailedToReceive`        | `((AdropInterstitialAd, AdropErrorCode) -> Void)?` | Closure callback for ad failed              |
| `onAdImpression`             | `((AdropInterstitialAd) -> Void)?`                 | Closure callback for ad impression          |
| `onAdClicked`                | `((AdropInterstitialAd) -> Void)?`                 | Closure callback for ad clicked             |
| `onAdWillPresentFullScreen`  | `((AdropInterstitialAd) -> Void)?`                 | Closure callback before presenting          |
| `onAdDidPresentFullScreen`   | `((AdropInterstitialAd) -> Void)?`                 | Closure callback after presenting           |
| `onAdWillDismissFullScreen`  | `((AdropInterstitialAd) -> Void)?`                 | Closure callback before dismissing          |
| `onAdDidDismissFullScreen`   | `((AdropInterstitialAd) -> Void)?`                 | Closure callback after dismissing           |
| `onAdFailedToShowFullScreen` | `((AdropInterstitialAd, AdropErrorCode) -> Void)?` | Closure callback for show failure           |

**Usage Example:**

```swift theme={null}
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

```swift theme={null}
init(unitId: String)
```

<ParamField body="unitId" type="String" required>
  Rewarded ad unit ID created in the Ad Control Console
</ParamField>

#### Methods

| Method                                                   | Return Type | Description                       |
| -------------------------------------------------------- | ----------- | --------------------------------- |
| `load()`                                                 | `void`      | Preload ad                        |
| `show(fromRootViewController:userDidEarnRewardHandler:)` | `void`      | Display ad and set reward handler |

##### show Method

```swift theme={null}
func show(
    fromRootViewController viewController: UIViewController,
    userDidEarnRewardHandler: @escaping (_ type: Int, _ amount: Int) -> Void
)
```

<ParamField body="viewController" type="UIViewController" required>
  Root view controller to present the ad from
</ParamField>

<ParamField body="userDidEarnRewardHandler" type="(_ type: Int, _ amount: Int) -> Void" required>
  Closure called when user earns a reward. `type` is the reward type and `amount` is the reward amount set in Ad Control Console.
</ParamField>

#### Properties

| Property                        | Type                                           | Description                                   |
| ------------------------------- | ---------------------------------------------- | --------------------------------------------- |
| `delegate`                      | `AdropRewardedAdDelegate?`                     | Delegate (read/write)                         |
| `isLoaded`                      | `Bool`                                         | Whether ad is loaded (read-only)              |
| `unitId`                        | `String`                                       | Unit ID (read-only)                           |
| `txId`                          | `String`                                       | Transaction ID (read-only)                    |
| `campaignId`                    | `String`                                       | Campaign ID (read-only)                       |
| `creativeId`                    | `String`                                       | Creative ID (read-only)                       |
| `isBackfilled`                  | `Bool`                                         | Whether the ad is a backfill ad (read-only)   |
| `destinationURL`                | `String`                                       | Ad destination URL (read-only)                |
| `browserTarget`                 | `BrowserTarget?`                               | How to open URLs on ad click (read-only)      |
| `serverSideVerificationOptions` | `AdropServerSideVerificationOptions?`          | Server-side verification options (read/write) |
| `onAdReceived`                  | `((AdropRewardedAd) -> Void)?`                 | Closure callback for ad received              |
| `onAdFailedToReceive`           | `((AdropRewardedAd, AdropErrorCode) -> Void)?` | Closure callback for ad failed                |
| `onAdImpression`                | `((AdropRewardedAd) -> Void)?`                 | Closure callback for ad impression            |
| `onAdClicked`                   | `((AdropRewardedAd) -> Void)?`                 | Closure callback for ad clicked               |
| `onAdWillPresentFullScreen`     | `((AdropRewardedAd) -> Void)?`                 | Closure callback before presenting            |
| `onAdDidPresentFullScreen`      | `((AdropRewardedAd) -> Void)?`                 | Closure callback after presenting             |
| `onAdWillDismissFullScreen`     | `((AdropRewardedAd) -> Void)?`                 | Closure callback before dismissing            |
| `onAdDidDismissFullScreen`      | `((AdropRewardedAd) -> Void)?`                 | Closure callback after dismissing             |
| `onAdFailedToShowFullScreen`    | `((AdropRewardedAd, AdropErrorCode) -> Void)?` | Closure callback for show failure             |

**Usage Example:**

```swift theme={null}
let rewardedAd = AdropRewardedAd(unitId: "YOUR_UNIT_ID")
rewardedAd.delegate = self
rewardedAd.load()

// After ad loads
if rewardedAd.isLoaded {
    rewardedAd.show(fromRootViewController: self) { type, amount in
        print("User earned a reward! type: \(type), amount: \(amount)")
        // Grant reward logic
    }
}
```

***

### AdropPopupAd

Class for displaying popup ads.

#### Initialization

```swift theme={null}
init(unitId: String)
```

<ParamField body="unitId" type="String" required>
  Popup ad unit ID created in the Ad Control Console
</ParamField>

#### Methods

| Method                          | Return Type | Description                             |
| ------------------------------- | ----------- | --------------------------------------- |
| `load()`                        | `void`      | Preload ad                              |
| `show(fromRootViewController:)` | `void`      | Display ad                              |
| `close()`                       | `void`      | Close ad                                |
| `open(_:useInAppBrowser:)`      | `void`      | Open URL (defaults to `destinationURL`) |

##### show Method

```swift theme={null}
func show(fromRootViewController viewController: UIViewController)
```

<ParamField body="viewController" type="UIViewController" required>
  Root view controller to present the ad from
</ParamField>

#### 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)                  |
| `unitId`                     | `String`                                    | Unit ID (read-only)                               |
| `txId`                       | `String`                                    | Current transaction ID (read-only)                |
| `txIds`                      | `[String]`                                  | All transaction IDs (read-only)                   |
| `campaignId`                 | `String`                                    | Current campaign ID (read-only)                   |
| `campaignIds`                | `[String]`                                  | All campaign IDs (read-only)                      |
| `creativeId`                 | `String?`                                   | Current creative ID (read-only)                   |
| `creativeIds`                | `[String]`                                  | All creative IDs (read-only)                      |
| `destinationURL`             | `String?`                                   | Ad destination URL (read-only)                    |
| `useCustomClick`             | `Bool`                                      | Whether to use custom click handling (read/write) |
| `browserTarget`              | `BrowserTarget?`                            | How to open URLs on ad click (read-only)          |
| `backgroundColor`            | `UIColor?`                                  | Popup background color (read/write)               |
| `hideForTodayTextColor`      | `UIColor?`                                  | "Don't show today" text color (read/write)        |
| `closeTextColor`             | `UIColor?`                                  | Close button text color (read/write)              |
| `ctaTextColor`               | `UIColor?`                                  | CTA text color (read/write)                       |
| `onAdReceived`               | `((AdropPopupAd) -> Void)?`                 | Closure callback for ad received                  |
| `onAdFailedToReceive`        | `((AdropPopupAd, AdropErrorCode) -> Void)?` | Closure callback for ad failed                    |
| `onAdImpression`             | `((AdropPopupAd) -> Void)?`                 | Closure callback for ad impression                |
| `onAdClicked`                | `((AdropPopupAd) -> Void)?`                 | Closure callback for ad clicked                   |
| `onAdWillPresentFullScreen`  | `((AdropPopupAd) -> Void)?`                 | Closure callback before presenting                |
| `onAdDidPresentFullScreen`   | `((AdropPopupAd) -> Void)?`                 | Closure callback after presenting                 |
| `onAdWillDismissFullScreen`  | `((AdropPopupAd) -> Void)?`                 | Closure callback before dismissing                |
| `onAdDidDismissFullScreen`   | `((AdropPopupAd) -> Void)?`                 | Closure callback after dismissing                 |
| `onAdFailedToShowFullScreen` | `((AdropPopupAd, AdropErrorCode) -> Void)?` | Closure callback for show failure                 |
| `onAdVideoStart`             | `((AdropPopupAd) -> Void)?`                 | Closure callback for video start                  |
| `onAdVideoEnd`               | `((AdropPopupAd) -> Void)?`                 | Closure callback for video end                    |
| `onClosed`                   | `((AdropPopupAd) -> Void)?`                 | Closure callback for close button                 |
| `onDimClicked`               | `((AdropPopupAd) -> Void)?`                 | Closure callback for dim area click               |
| `onTodayOffClicked`          | `((AdropPopupAd) -> Void)?`                 | Closure callback for "Don't show today"           |

**Usage Example:**

```swift theme={null}
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.

<Note>
  `AdropSplashAd` cannot be instantiated directly (the initializer is internal). Use `AdropSplashAdViewController` or `AdropSplashAdView` to display splash ads.
</Note>

#### Properties

| Property         | Type                     | Description                                    |
| ---------------- | ------------------------ | ---------------------------------------------- |
| `delegate`       | `AdropSplashAdDelegate?` | Delegate (read/write)                          |
| `unitId`         | `String`                 | Unit ID (read-only)                            |
| `txId`           | `String`                 | Transaction ID (read-only)                     |
| `campaignId`     | `String`                 | Campaign ID (read-only)                        |
| `creativeId`     | `String`                 | Creative ID (read-only)                        |
| `destinationURL` | `String`                 | Ad destination URL (read-only)                 |
| `readyToShow`    | `Bool`                   | Whether the ad is ready to display (read-only) |
| `adImage`        | `UIImage?`               | Cached ad image (read-only)                    |

***

### AdropSplashAdViewController

View controller for displaying splash ads in full screen.

#### Initialization

```swift theme={null}
init(unitId: String, adRequestTimeout: TimeInterval = 1)
```

<ParamField body="unitId" type="String" required>
  Splash ad unit ID created in the Ad Control Console
</ParamField>

<ParamField body="adRequestTimeout" type="TimeInterval" default="1">
  Ad request timeout in seconds
</ParamField>

#### Methods

| Method    | Return Type | Description                                                |
| --------- | ----------- | ---------------------------------------------------------- |
| `close()` | `void`      | Close the splash ad and transition to `mainViewController` |

#### Properties

| Property             | Type                     | Description                                                               |
| -------------------- | ------------------------ | ------------------------------------------------------------------------- |
| `delegate`           | `AdropSplashAdDelegate?` | Delegate (read/write)                                                     |
| `splashAd`           | `AdropSplashAd`          | Underlying splash ad object (read-only)                                   |
| `displayDuration`    | `TimeInterval`           | Ad display duration (default: 1 second, deprecated — set in console)      |
| `logoImage`          | `UIImage?`               | Logo image to display at bottom (read/write)                              |
| `backgroundColor`    | `UIColor?`               | Background color (read/write)                                             |
| `mainViewController` | `UIViewController?`      | Main view controller to transition to after splash ad closes (read/write) |

**Usage Example:**

```swift theme={null}
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 `UIImageView`.

#### Initialization

```swift theme={null}
init(unitId: String, adRequestTimeout: TimeInterval = 1)
```

<ParamField body="unitId" type="String" required>
  Splash ad unit ID created in the Ad Control Console
</ParamField>

<ParamField body="adRequestTimeout" type="TimeInterval" default="1">
  Ad request timeout in seconds
</ParamField>

<Note>
  Loading happens automatically on initialization. Do not call `load()` directly.
</Note>

#### Properties

| Property          | Type                         | Description                                       |
| ----------------- | ---------------------------- | ------------------------------------------------- |
| `delegate`        | `AdropSplashAdViewDelegate?` | Delegate (read/write)                             |
| `ad`              | `AdropSplashAd`              | Underlying splash ad object (read-only)           |
| `unitId`          | `String`                     | Unit ID (read-only)                               |
| `txId`            | `String?`                    | Transaction ID (read-only)                        |
| `creativeId`      | `String`                     | Creative ID (read-only)                           |
| `isClosed`        | `Bool`                       | Whether the splash ad has closed (read-only)      |
| `displayDuration` | `TimeInterval`               | Ad display duration (deprecated — set in console) |

***

### AdropMetrics

Class for managing user properties and events.

#### Static Properties

| Property          | Type   | Description                                           |
| ----------------- | ------ | ----------------------------------------------------- |
| `userDataConsent` | `Bool` | User data consent status (default: `true`, read-only) |

#### Static Methods

| Method                    | Return Type           | Description                                                                                                                                        |
| ------------------------- | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `setUserDataConsent(_:)`  | `void`                | Set user data collection consent (`true` = consent, `false` = no consent). When set to `false`, data is stored locally but not sent to the server. |
| `setProperty(key:value:)` | `void`                | Set user property                                                                                                                                  |
| `properties()`            | `[String: Encodable]` | Get all stored user properties                                                                                                                     |
| `sendEvent(name:params:)` | `void`                | Send user event                                                                                                                                    |
| `logEvent(name:params:)`  | `void`                | **Deprecated.** Use `sendEvent` instead.                                                                                                           |

#### Set User Property

```swift theme={null}
static func setProperty(key: String, value: Encodable?)
```

<ParamField body="key" type="String" required>
  Property key (max 64 characters)
</ParamField>

<ParamField body="value" type="Any" required>
  Property value (supports String, Int, Double, Bool)
</ParamField>

**Usage Example:**

```swift theme={null}
AdropMetrics.setProperty(key: "age", value: 25)
AdropMetrics.setProperty(key: "gender", value: "male")
AdropMetrics.setProperty(key: "isPremium", value: true)
```

#### Get Properties

```swift theme={null}
static func properties() -> [String: Encodable]
```

Returns all user properties currently stored via `setProperty(key:value:)`.

**Usage Example:**

```swift theme={null}
let stored = AdropMetrics.properties()
print(stored)
```

#### Send Event

```swift theme={null}
static func sendEvent(name: String, params: [String: Any]? = nil)
```

<ParamField body="name" type="String" required>
  Event name (1–64 characters)
</ParamField>

<ParamField body="params" type="[String: Any]?" optional>
  Event parameters dictionary. Keys max 64 characters, string values max 1024 characters.
</ParamField>

**Usage Example:**

```swift theme={null}
// Simple event
AdropMetrics.sendEvent(name: "app_open")

// Event with parameters
AdropMetrics.sendEvent(name: "view_item", params: [
    "item_id": "SKU-123",
    "item_name": "Widget",
    "price": 29.99
])

// Multi-item event (purchase)
AdropMetrics.sendEvent(name: "purchase", params: [
    "tx_id": "tx_123",
    "currency": "KRW",
    "items": [
        ["item_id": "A", "item_name": "Product A", "price": 100, "quantity": 1],
        ["item_id": "B", "item_name": "Product B", "price": 200, "quantity": 2]
    ]
])
```

<Warning>
  `logEvent()` is deprecated and will be removed in a future version. Use `sendEvent()` instead.
</Warning>

<Note>
  * Event name must be 1–64 characters.
  * Duplicate events with the same name and parameters are throttled (500ms window).
  * The SDK must be initialized before calling `sendEvent()`.
</Note>

#### Log Event (Deprecated)

```swift theme={null}
@available(*, deprecated, renamed: "sendEvent(name:params:)")
static func logEvent(name: String, params: [String: Encodable]? = [:])
```

<Warning>
  This method is deprecated. Use `sendEvent(name:params:)` instead.
</Warning>

***

## Protocols (Delegates)

### AdropBannerDelegate

Protocol for handling banner ad lifecycle events.

#### Required Methods

```swift theme={null}
func onAdReceived(_ banner: AdropBanner)
```

Called when ad is received successfully.

```swift theme={null}
func onAdFailedToReceive(_ banner: AdropBanner, _ errorCode: AdropErrorCode)
```

Called when ad fails to receive.

#### Optional Methods

```swift theme={null}
optional func onAdImpression(_ banner: AdropBanner)
```

Called when ad is displayed on screen.

```swift theme={null}
optional func onAdClicked(_ banner: AdropBanner)
```

Called when user clicks the ad.

```swift theme={null}
optional func onAdsReceived(_ banners: [AdropBanner])
```

Called when a batch of banner ads is received from `AdropBanner.loads(...)`.

```swift theme={null}
optional func onAdsFailedToReceive(_ errorCode: AdropErrorCode)
```

Called when a batch load from `AdropBanner.loads(...)` fails.

**Implementation Example:**

```swift theme={null}
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

```swift theme={null}
func onAdReceived(_ ad: AdropNativeAd)
```

Called when ad is received successfully.

```swift theme={null}
func onAdFailedToReceive(_ ad: AdropNativeAd, _ errorCode: AdropErrorCode)
```

Called when ad fails to receive.

#### Optional Methods

```swift theme={null}
optional func onAdImpression(_ ad: AdropNativeAd)
```

Called when ad is displayed on screen.

```swift theme={null}
optional func onAdClicked(_ ad: AdropNativeAd)
```

Called when user clicks the ad.

```swift theme={null}
optional func onAdsReceived(_ ads: [AdropNativeAd])
```

Called when a batch of native ads is received from `AdropNativeAd.loads(...)`.

```swift theme={null}
optional func onAdsFailedToReceive(_ errorCode: AdropErrorCode)
```

Called when a batch load from `AdropNativeAd.loads(...)` fails.

***

### AdropInterstitialAdDelegate

Protocol for handling interstitial ad lifecycle events.

#### Required Methods

```swift theme={null}
func onAdReceived(_ ad: AdropInterstitialAd)
```

Called when ad is received successfully.

```swift theme={null}
func onAdFailedToReceive(_ ad: AdropInterstitialAd, _ errorCode: AdropErrorCode)
```

Called when ad fails to receive.

#### Optional Methods

```swift theme={null}
optional func onAdImpression(_ ad: AdropInterstitialAd)
```

Called when ad is displayed on screen.

```swift theme={null}
optional func onAdClicked(_ ad: AdropInterstitialAd)
```

Called when user clicks the ad.

```swift theme={null}
optional func onAdWillPresentFullScreen(_ ad: AdropInterstitialAd)
```

Called just before the ad is displayed in full screen.

```swift theme={null}
optional func onAdDidPresentFullScreen(_ ad: AdropInterstitialAd)
```

Called immediately after the ad is displayed in full screen.

```swift theme={null}
optional func onAdWillDismissFullScreen(_ ad: AdropInterstitialAd)
```

Called just before the ad is dismissed.

```swift theme={null}
optional func onAdDidDismissFullScreen(_ ad: AdropInterstitialAd)
```

Called when ad is closed.

```swift theme={null}
optional func onAdFailedToShowFullScreen(_ ad: AdropInterstitialAd, _ errorCode: AdropErrorCode)
```

Called when ad fails to show.

***

### AdropRewardedAdDelegate

Protocol for handling rewarded ad lifecycle events.

#### Required Methods

```swift theme={null}
func onAdReceived(_ ad: AdropRewardedAd)
```

Called when ad is received successfully.

```swift theme={null}
func onAdFailedToReceive(_ ad: AdropRewardedAd, _ errorCode: AdropErrorCode)
```

Called when ad fails to receive.

#### Optional Methods

```swift theme={null}
optional func onAdImpression(_ ad: AdropRewardedAd)
```

Called when ad is displayed on screen.

```swift theme={null}
optional func onAdClicked(_ ad: AdropRewardedAd)
```

Called when user clicks the ad.

```swift theme={null}
optional func onAdWillPresentFullScreen(_ ad: AdropRewardedAd)
```

Called just before the ad is displayed in full screen.

```swift theme={null}
optional func onAdDidPresentFullScreen(_ ad: AdropRewardedAd)
```

Called immediately after the ad is displayed in full screen.

```swift theme={null}
optional func onAdWillDismissFullScreen(_ ad: AdropRewardedAd)
```

Called just before the ad is dismissed.

```swift theme={null}
optional func onAdDidDismissFullScreen(_ ad: AdropRewardedAd)
```

Called when ad is closed.

```swift theme={null}
optional func onAdFailedToShowFullScreen(_ ad: AdropRewardedAd, _ errorCode: AdropErrorCode)
```

Called when ad fails to show.

***

### AdropPopupAdDelegate

Protocol for handling popup ad lifecycle events.

#### Required Methods

```swift theme={null}
func onAdReceived(_ ad: AdropPopupAd)
```

Called when ad is received successfully.

```swift theme={null}
func onAdFailedToReceive(_ ad: AdropPopupAd, _ errorCode: AdropErrorCode)
```

Called when ad fails to receive.

#### Optional Methods

```swift theme={null}
optional func onAdImpression(_ ad: AdropPopupAd)
```

Called when ad is displayed on screen.

```swift theme={null}
optional func onAdClicked(_ ad: AdropPopupAd)
```

Called when user clicks the ad.

```swift theme={null}
optional func onAdWillPresentFullScreen(_ ad: AdropPopupAd)
```

Called just before the popup ad is displayed.

```swift theme={null}
optional func onAdDidPresentFullScreen(_ ad: AdropPopupAd)
```

Called immediately after the popup ad is displayed.

```swift theme={null}
optional func onAdWillDismissFullScreen(_ ad: AdropPopupAd)
```

Called just before the popup ad is dismissed.

```swift theme={null}
optional func onAdDidDismissFullScreen(_ ad: AdropPopupAd)
```

Called when ad is closed.

```swift theme={null}
optional func onAdFailedToShowFullScreen(_ ad: AdropPopupAd, _ errorCode: AdropErrorCode)
```

Called when ad fails to show.

***

### AdropPopupAdCloseDelegate

Protocol for handling popup ad close events.

#### Optional Methods

```swift theme={null}
optional func onClosed(_ ad: AdropPopupAd)
```

Called when user clicks the close button.

```swift theme={null}
optional func onDimClicked(_ ad: AdropPopupAd)
```

Called when user clicks outside the popup (dim area).

```swift theme={null}
optional func onTodayOffClicked(_ ad: AdropPopupAd)
```

Called when user selects "Don't show today".

***

### AdropSplashAdDelegate

Protocol for handling splash ad lifecycle events. All methods are `@objc optional`.

#### Optional Methods

```swift theme={null}
optional func onAdReceived(_ ad: AdropSplashAd)
```

Called when ad is received successfully.

```swift theme={null}
optional func onAdFailedToReceive(_ ad: AdropSplashAd, _ errorCode: AdropErrorCode)
```

Called when ad fails to receive.

```swift theme={null}
optional func onAdImpression(_ ad: AdropSplashAd)
```

Called when ad is displayed on screen.

```swift theme={null}
optional func onAdClose(_ ad: AdropSplashAd, impressed: Bool)
```

Called when the splash ad is closed. `impressed` indicates whether the ad was fully displayed.

***

### AdropSplashAdViewDelegate

Protocol for handling splash ad view lifecycle events.

#### Required Methods

```swift theme={null}
func onAdClose(_ adView: AdropSplashAdView, impressed: Bool)
```

Called when the splash ad view is closed. `impressed` indicates whether the ad was fully displayed.

#### Optional Methods

```swift theme={null}
optional func onAdReceived(_ adView: AdropSplashAdView)
```

Called when ad is received successfully.

```swift theme={null}
optional func onAdFailedToReceive(_ adView: AdropSplashAdView, _ errorCode: AdropErrorCode)
```

Called when ad fails to receive.

```swift theme={null}
optional func onAdImpression(_ adView: AdropSplashAdView)
```

Called when ad is displayed on screen.

***

### UseCustomClick

Protocol for handling custom ad click behavior. Implemented by `AdropBanner`, `AdropNativeAd`, and `AdropPopupAd`.

| Property / Method          | Type      | Description                                                                       |
| -------------------------- | --------- | --------------------------------------------------------------------------------- |
| `destinationURL`           | `String?` | The destination URL of the ad (read-only)                                         |
| `useCustomClick`           | `Bool`    | When `true`, disables automatic URL opening on ad click                           |
| `open(_:useInAppBrowser:)` | Method    | Opens a URL manually. Call this in click callback when `useCustomClick` is `true` |

***

## Enums

### AdropErrorCode

Error codes that can occur during ad loading and display.

```swift theme={null}
enum AdropErrorCode: Int
```

| Case                                      | Code Value | Description                  |
| ----------------------------------------- | ---------- | ---------------------------- |
| `ERROR_CODE_NETWORK`                      | 0          | Network error                |
| `ERROR_CODE_INTERNAL`                     | 1          | Internal error               |
| `ERROR_CODE_INITIALIZE`                   | 2          | SDK initialization failed    |
| `ERROR_CODE_INVALID_UNIT`                 | 3          | Invalid unit ID              |
| `ERROR_CODE_NOT_TARGET_COUNTRY`           | 4          | Not a target country         |
| `ERROR_CODE_AD_INACTIVE`                  | 5          | No active campaigns          |
| `ERROR_CODE_AD_NO_FILL`                   | 6          | No ads available to display  |
| `ERROR_CODE_AD_LOAD_DUPLICATED`           | 7          | Duplicate ad load request    |
| `ERROR_CODE_AD_LOADING`                   | 8          | Ad is loading                |
| `ERROR_CODE_AD_EMPTY`                     | 9          | Ad not loaded                |
| `ERROR_CODE_AD_SHOWN`                     | 10         | Ad already shown             |
| `ERROR_CODE_AD_HIDE_FOR_TODAY`            | 11         | "Don't show today" is set    |
| `ERROR_CODE_ACCOUNT_USAGE_LIMIT_EXCEEDED` | 12         | Account usage limit exceeded |
| `ERROR_CODE_LANDSCAPE_UNSUPPORTED`        | 13         | Landscape mode not supported |
| `ERROR_CODE_AD_BACKFILL_NO_FILL`          | 14         | 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:**

```swift theme={null}
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.

```swift theme={null}
enum AdropTheme
```

| Case    | Description                     |
| ------- | ------------------------------- |
| `light` | Light mode                      |
| `dark`  | Dark mode                       |
| `auto`  | Follow system setting (default) |

**Usage Example:**

```swift theme={null}
// Set light mode
Adrop.setTheme(.light)

// Set dark mode
Adrop.setTheme(.dark)

// Follow system setting
Adrop.setTheme(.auto)
```

***

### BrowserTarget

Controls how ad URLs are opened.

| Value      | Description                                         |
| ---------- | --------------------------------------------------- |
| `EXTERNAL` | Opens URL in the default external browser (default) |
| `INTERNAL` | Opens URL in an in-app browser                      |

***

## Structs and Types

### AdropNativeAdProfile

Struct containing advertiser profile information.

```swift theme={null}
struct AdropNativeAdProfile {
    let displayLogo: String     // Advertiser logo URL
    let displayName: String     // Advertiser name
    let link: String?           // Advertiser profile link
}
```

**Usage Example:**

```swift theme={null}
let profile = nativeAd.profile
profileNameLabel.text = profile.displayName
loadImage(from: profile.displayLogo, into: profileImageView)
```

### AdropServerSideVerificationOptions

Class for setting server-side verification options for rewarded ads.

```swift theme={null}
class AdropServerSideVerificationOptions: NSObject {
    var userId: String?
    var customData: String?

    init(userId: String? = nil, customData: String? = nil)
}
```

| Property     | Type      | Description                                          |
| ------------ | --------- | ---------------------------------------------------- |
| `userId`     | `String?` | User identifier for server-side verification         |
| `customData` | `String?` | Custom data string to include in the server callback |

**Usage Example:**

```swift theme={null}
let options = AdropServerSideVerificationOptions(
    userId: "user_12345",
    customData: "level_5_reward"
)
rewardedAd.serverSideVerificationOptions = options
```

***

## Constants

### AdropUnitId

Test unit ID constants.

```swift theme={null}
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: String
    static let PUBLIC_TEST_UNIT_ID_NATIVE_VIDEO_16_9: String
    static let PUBLIC_TEST_UNIT_ID_NATIVE_VIDEO_9_16: 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_BOTTOM: String
    static let PUBLIC_TEST_UNIT_ID_POPUP_CENTER: String
    static let PUBLIC_TEST_UNIT_ID_POPUP_BOTTOM_VIDEO_16_9: String
    static let PUBLIC_TEST_UNIT_ID_POPUP_BOTTOM_VIDEO_9_16: String
    static let PUBLIC_TEST_UNIT_ID_POPUP_CENTER_VIDEO_16_9: 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:**

```swift theme={null}
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)
let interstitial = AdropInterstitialAd(unitId: AdropUnitId.PUBLIC_TEST_UNIT_ID_INTERSTITIAL)
let popup = AdropPopupAd(unitId: AdropUnitId.PUBLIC_TEST_UNIT_ID_POPUP_CENTER)
```

<Warning>
  Use test unit IDs only in development environments. You must use actual unit IDs created in the console for production.
</Warning>

***

## Additional Resources

<CardGroup cols={2}>
  <Card title="Banner Ads" href="/sdk/ios/banner" icon="rectangle-ad">
    Banner ad implementation guide
  </Card>

  <Card title="Native Ads" href="/sdk/ios/native" icon="grid-2">
    Native ad implementation guide
  </Card>

  <Card title="Interstitial Ads" href="/sdk/ios/interstitial" icon="window-maximize">
    Interstitial ad implementation guide
  </Card>

  <Card title="Rewarded Ads" href="/sdk/ios/rewarded" icon="gift">
    Rewarded ad implementation guide
  </Card>
</CardGroup>
