Skip to main content

Native Simple Ad Options

Ad Requset Timeout

Set timeout (seconds) for ad requests. GFPAdLoaderDelegate will call adLoader:didFailWithError:responseInfo: on timeout. Default is 60 seconds.

self.adLoader?.requestTimeoutInterval = ...

Interface Style

Configure interface style to customize icon's appearance.

This setting overrides Global Interface Style Setting. Use this setting to alter the appearance in certain contexts.

let simpleRenderingSetting = GFPNativeSimpleAdRenderingSetting()
simpleRenderingSetting.adInterfaceStyle = .light
simpleRenderingSetting.adInterfaceStyle = .dark
simpleRenderingSetting.adInterfaceStyle = .system

let nativeSimpleOption = GFPAdNativeSimpleOptions()
nativeSimpleOption.simpleAdRenderingSetting = simpleRenderingSetting

Custom AdChoices Icon

AdChoices (or AdMute) icon or button is located on a corner of ad, providing users for options to hide unwanted ad.

The icon's appearance can be customized by setting GFPNativeAdRenderingSetting.adChociesCustomAsset

let customAsset = GFPCustomAsset(bundle: Bundle.main, size: CGSize(width: 42, height: 16), lightModeName: "commAd", darkModeName: "commAd_dark")

let simpleRenderingSetting = GFPNativeSimpleAdRenderingSetting()
simpleRenderingSetting.adChoicesCustomAsset = customAsset

let nativeSimpleOption = GFPAdNativeSimpleOptions()
nativeSimpleOption.simpleAdRenderingSetting = simpleRenderingSetting

Thumbnail for GFPMediaView

Set thumbnail on GFPMediaView to add natural feels to the ad before loading images. Thumbnail will be shown right after showPlaceholder, which automatically fits into GFPMediaView. The thumbnail will be removed by assigning GFPNativeAd instance to the GFPNativeAdView.

let nativeSimpleAdView = GFPNativeSimpleAdView()
self.addSubview(nativeSimpleAdView)
nativeSimpleAdView.frame = .init(x: 0, y: 0, width: 123, height: 123)
nativeSimpleAdView.mediaView?.showPlaceholder { imageView in
imageView.image = UIImage(named: "my_thumbnail")
imageView.contentMode = .scaleAspectFill
imageView.clipsToBounds = true
}