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

# Light Popup Ads

> Implement light popup ads in your iOS app.

<Note>
  Load ads after [SDK initialization](/en/sdk-integration-v2/ios_new/get-started#initialize-sdk) succeeds. Swift examples require `import Daro`; Objective-C examples use `DaroObjCBridge`. For an existing integration, follow the [migration guide](/en/sdk-integration-v2/ios_new/migration-guide) first.
</Note>

## Light Popup Ad Format

Displays an ad as a popup over your app screen.

<img src="https://mintcdn.com/delightroom-5a71a6a8/LXIzQfIe2eSe0uQc/sdk-integration/common-img/ad-formats-en/ios-light-popup-default.png?fit=max&auto=format&n=LXIzQfIe2eSe0uQc&q=85&s=b1de45e868197a0f1dea8495a6eb0ed8" alt="Ios Light Popup Example Pn" title="Ios Light Popup Example Pn" style={{ width:"39%" }} width="782" height="1696" data-path="sdk-integration/common-img/ad-formats-en/ios-light-popup-default.png" />

***

## Ad Unit Setup

Configure your Ad Unit using the Ad Unit Key issued from the dashboard.

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    let lightPopupAdUnit = DaroAdUnit(unitId: "your_light_popup_unit_id")
    ```
  </Tab>

  <Tab title="Objective-C">
    ```objc theme={null}
    // In Objective-C, unitId is passed directly during initialization
    NSString *lightPopupUnitId = @"your_light_popup_unit_id";
    ```
  </Tab>
</Tabs>

***

## Light Popup Ad Implementation

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    class ExampleViewController: UIViewController {
        private var daroLightPopupAd: DaroLightPopupAd? = nil
        let daroLightPopupLoader = DaroLightPopupAdLoader(unit: lightPopupAdUnit)

        override func viewDidLoad() {
            super.viewDidLoad()
            setupLightPopupAd()
        }

        private func setupLightPopupAd() {
            // Ad click listener
            daroLightPopupLoader.listener.onAdClicked = { adInfo in
                print("[DARO] Listener Light Popup Ad clicked: \(adInfo)")
            }

            // Ad impression listener
            daroLightPopupLoader.listener.onAdImpression = { adInfo in
                print("[DARO] Listener Light Popup Ad impression: \(adInfo)")
            }

            // Ad load success listener
            daroLightPopupLoader.listener.onAdLoadSuccess = { [weak self] ad, adInfo in
                print("[DARO] Listener Light Popup Ad loaded: \(ad) \(adInfo)")
                self?.daroLightPopupAd = ad

                // Ad show success listener
                self?.daroLightPopupAd?.lightPopupAdListener.onShown = { adInfo in
                    print("[DARO] Listener Light Popup Ad shown: \(adInfo)")
                }

                // Ad dismiss listener
                self?.daroLightPopupAd?.lightPopupAdListener.onDismiss = { adInfo in
                    print("[DARO] Listener Light Popup Ad dismissed: \(adInfo)")
                }

                // Ad show fail listener
                self?.daroLightPopupAd?.lightPopupAdListener.onFailedToShow = { adInfo, error in
                    print("[DARO] Listener Light Popup Ad failed to show: \(adInfo) \(error)")
                }
            }

            // Ad load fail listener
            daroLightPopupLoader.listener.onAdLoadFail = { error in
                print("[DARO] Listener Light Popup Ad failed: \(error)")
            }

            daroLightPopupLoader.loadAd()
        }

        private func showLightPopupAd() {
            daroLightPopupAd?.show(viewController: self)
        }
    }
    ```
  </Tab>

  <Tab title="Objective-C">
    **1. Adopt the delegate protocol in your header file:**

    ```objc theme={null}
    @interface ExampleViewController () <DaroObjCLightPopupAdLoaderDelegate, DaroObjCLightPopupAdDelegate>
    @property (nonatomic, strong) DaroObjCLightPopupAdLoader *lightPopupLoader;
    @property (nonatomic, strong) DaroObjCLightPopupAd *lightPopupAd;
    @end
    ```

    Retain the ad received in the load-success callback before showing it. The loader delegate receives load, click, and impression events; the ad delegate receives show, dismiss, and show-failure events. Apply configuration to the loaded ad before calling `showFrom:`. Load again for the next ad.

    **2. Setup and load light popup ad:**

    ```objc theme={null}
    - (void)setupLightPopupAd {
        self.lightPopupAd = nil;
        self.lightPopupLoader = [[DaroObjCLightPopupAdLoader alloc]
            initWithUnitId:@"your_light_popup_unit_id"];
        self.lightPopupLoader.delegate = self;

        // Load ad
        [self.lightPopupLoader loadAd];
    }
    ```

    **3. Implement delegate methods:**

    ```objc theme={null}
    #pragma mark - DaroObjCLightPopupAdLoaderDelegate / DaroObjCLightPopupAdDelegate

    - (void)lightPopupAdLoaderDidLoad:(DaroObjCLightPopupAdLoader *)loader
                                  ad:(DaroObjCLightPopupAd *)ad
                              adInfo:(DaroObjCAdInfo *)adInfo {
        self.lightPopupAd = ad;
        ad.delegate = self;
        NSLog(@"[DARO] Light popup ad loaded - Unit: %@", adInfo.adUnitId);
    }

    - (void)lightPopupAdLoader:(DaroObjCLightPopupAdLoader *)loader
                 didFailWithError:(NSError *)error {
        NSLog(@"[DARO] Failed to load: %@", error.localizedDescription);
    }

    - (void)lightPopupAdDidShow:(DaroObjCLightPopupAd *)ad
                         adInfo:(DaroObjCAdInfo *)adInfo {
        NSLog(@"[DARO] Light popup ad shown");
    }

    - (void)lightPopupAd:(DaroObjCLightPopupAd *)ad
                  didFailToShow:(NSError *)error
                         adInfo:(DaroObjCAdInfo *)adInfo {
        NSLog(@"[DARO] Failed to show: %@", error.localizedDescription);
    }

    - (void)lightPopupAdLoaderDidClick:(DaroObjCLightPopupAdLoader *)loader
                          adInfo:(DaroObjCAdInfo *)adInfo {
        NSLog(@"[DARO] Light popup ad clicked");
    }

    - (void)lightPopupAdLoaderDidRecordImpression:(DaroObjCLightPopupAdLoader *)loader
                                     adInfo:(DaroObjCAdInfo *)adInfo {
        NSLog(@"[DARO] Impression recorded");
    }

    - (void)lightPopupAdDidDismiss:(DaroObjCLightPopupAd *)ad
                            adInfo:(DaroObjCAdInfo *)adInfo {
        NSLog(@"[DARO] Light popup ad dismissed");
        self.lightPopupAd = nil;
    }
    ```

    **4. Show ad:**

    ```objc theme={null}
    - (void)showLightPopupAd {
        if (self.lightPopupAd != nil) {
            [self.lightPopupAd showFrom:self];
        } else {
            NSLog(@"[DARO] Ad is not ready to show");
        }
    }
    ```
  </Tab>
</Tabs>

## Light Popup Configuration

You can customize the style of light popup ads:

<Tabs>
  <Tab title="Swift">
    ```swift theme={null}
    let configuration = DaroLightPopupConfiguration()

    // Set background colors
    configuration.backgroundColor = UIColor.black.withAlphaComponent(0.4) // Overall background color
    configuration.cardViewBackgroundColor = .systemBackground // Card view background color

    // Ad mark label settings
    configuration.adMarkLabelTextColor = .secondaryLabel // Ad mark text color
    configuration.adMarkLabelBackgroundColor = .secondarySystemBackground // Ad mark background color

    // Close button settings
    configuration.closeButtonText = "Close" // Close button text
    configuration.closeButtonTextColor = .label // Close button text color

    // Title settings
    configuration.titleTextColor = .label // Title text color

    // Body settings
    configuration.bodyTextColor = .secondaryLabel // Body text color

    // CTA button settings
    configuration.ctaButtonTextColor = .white // CTA button text color
    configuration.ctaButtonBackgroundColor = .systemBlue // CTA button background color

    daroLightPopupAd?.configuration = configuration
    ```
  </Tab>

  <Tab title="Objective-C">
    ```objc theme={null}
    DaroObjCLightPopupConfiguration *configuration = [[DaroObjCLightPopupConfiguration alloc] init];

    // Set background colors
    configuration.backgroundColor = [UIColor.blackColor colorWithAlphaComponent:0.4]; // Overall background color
    configuration.cardViewBackgroundColor = UIColor.systemBackgroundColor; // Card view background color

    // Ad mark label settings
    configuration.adMarkLabelTextColor = UIColor.secondaryLabelColor; // Ad mark text color
    configuration.adMarkLabelBackgroundColor = UIColor.secondarySystemBackgroundColor; // Ad mark background color

    // Close button settings
    configuration.closeButtonText = @"Close"; // Close button text
    configuration.closeButtonTextColor = UIColor.labelColor; // Close button text color

    // Title settings
    configuration.titleTextColor = UIColor.labelColor; // Title text color

    // Body settings
    configuration.bodyTextColor = UIColor.secondaryLabelColor; // Body text color

    // CTA button settings
    configuration.ctaButtonTextColor = UIColor.whiteColor; // CTA button text color
    configuration.ctaButtonBackgroundColor = UIColor.systemBlueColor; // CTA button background color

    [self.lightPopupAd setConfiguration:configuration];
    ```
  </Tab>
</Tabs>
