NativeAd

@objc(YMANativeAd)
public protocol NativeAd : NSObjectProtocol

The protocol provides methods for managing an ad and getting the values of the ad assets.

  • Type of native ad. For acceptable values, see NativeAdType.

    Declaration

    Swift

    var adType: NativeAdType { get }
  • An object implementing the NativeAdDelegate protocol that receives events triggered by the user’s interaction with the ad.

    Declaration

    Swift

    var delegate: NativeAdDelegate? { get set }
  • Any string in the ad (set in the Partner interface).

    Warning

    This property is only used for working with ADFOX.

    Declaration

    Swift

    var info: String? { get }
  • ads

    An array with nested ads.

    Declaration

    Swift

    var ads: [NativeAd] { get }
  • An object with ad assets.

    Declaration

    Swift

    func adAssets() -> NativeAdAssets

    Return Value

    Returns an object containing the ad assets.

  • Loads images if manual loading is selected.

    Warning

    All images are cached, but they can be deleted at any time, so you need to call this method before every ad impression.

    Declaration

    Swift

    func loadImages()
  • Adds an observer that receives notifications about the image loading process.

    Declaration

    Swift

    @objc(addImageLoadingObserver:)
    func add(_ observer: NativeAdImageLoadingObserver)

    Parameters

    observer

    The observer of the image loading process.

  • Removes the observer that receives notifications about the image loading process.

    Declaration

    Swift

    @objc(removeImageLoadingObserver:)
    func remove(_ observer: NativeAdImageLoadingObserver)

    Parameters

    observer

    The observer of the image loading process.

  • Sets values of all ad assets to native ad view, installs impression and click handlers.

    Declaration

    Swift

    @objc(bindWithAdView:error:)
    func bind(with adView: YMANativeAdView) throws

    Parameters

    adView

    NativeAdView with views for ad assets.

    error

    Binding error. - seealso:  NativeAdErrorCode for error codes.

    Return Value

    true if binding succeeded, otherwise false.

  • Configures views for native ads displlay in slider.

    Declaration

    Swift

    func bindAd(toSliderView sliderView: YMANativeAdView) throws

    Parameters

    sliderView

    Root slider ad view with general assets

    error

    Binding error. - seealso: NativeAdErrorCode for error codes.

    Return Value

    true if binding succeeded, otherwise false.