YMANativeAd

Objective-C

@protocol YMANativeAd <NSObject>

Swift

protocol YMANativeAd : NSObjectProtocol

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

  1. Properties
  2. adType
  3. delegate
  4. Methods
  5. -addImageLoadingObserver:
  6. -removeImageLoadingObserver:
  7. -adAssets
  8. info
  9. ads
  10. -loadImages
  11. -bindWithAdView:error:
  12. -bindAdToSliderView:error:

Properties

adType

Type of native ad. See acceptable values in YMANativeAdType.

Declaration

Objective-C

@property (nonatomic, readonly) int adType;

Swift

unowned(unsafe) var adType: YMANativeAdView! { get }

delegate

An object implementing the YMANativeAdDelegate protocol that receives events triggered by the user’s interaction with the ad.

Declaration

Objective-C

@property (nonatomic, weak, nullable) id<YMANativeAdDelegate> delegate;

Methods

-addImageLoadingObserver:

Adds an observer that receives notifications about the image loading process.

Declaration

Objective-C

- (void)addImageLoadingObserver:
    (nonnull id<YMANativeAdImageLoadingObserver>)observer;

Parameters

observer

The observer of the image loading process (YMANativeAdImageLoadingObserver).

observer

The observer of the image loading process (YMANativeAdImageLoadingObserver).

-removeImageLoadingObserver:

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

Declaration

Objective-C

- (void)removeImageLoadingObserver:
    (nonnull id<YMANativeAdImageLoadingObserver>)observer;

Parameters

observer

The observer of the image loading process (YMANativeAdImageLoadingObserver).

observer

The observer of the image loading process (YMANativeAdImageLoadingObserver).

-adAssets

An object with ad assets (YMANativeAdAssets).

Declaration

Objective-C

- (nonnull YMANativeAdAssets *)adAssets;

Swift

func adAssets() -> YMANativeAdAssets

Return Value

Returns an object containing the ad assets.

info

Any string in the ad (set in the Partner interface).

Warning This property is used for working with Adfox.

Declaration

Objective-C

@property (nonatomic, copy, readonly, nullable) NSString *info;

Swift

var info: String? { get }

ads

An array of nested ads.

Declaration

Objective-C

@property (nonatomic, copy, readonly) NSArray<id<YMANativeAd>> *_Nonnull ads;

Swift

var ads: [YMANativeAd] { get }

-loadImages

Loads images if manual loading is selected.

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

Declaration

Objective-C

- (void)loadImages;

Swift

func loadImages()

-bindWithAdView:error:

Sets the values of all view assets for native ads and installs impression and click handlers.

Declaration

Objective-C

- (BOOL)bindWithAdView:(nonnull YMANativeAdView *)adView
                 error:(NSError *_Nullable *_Nullable)error;

Swift

func bind(with adView: YMANativeAdView) throws

Parameters

adView

YMANativeAdView with ad assets.

error

Information about the error (for details, see YMANativeAdErrors.h).

adView

YMANativeAdView with ad assets.

error

Information about the error (for details, see YMANativeAdErrors.h).

Return Value

Result of setting ad assets (YES/NO).

-bindAdToSliderView:error:

Configures views for displaying native ads in the slider.

Declaration

Objective-C

- (BOOL)bindAdToSliderView:(nonnull YMANativeAdView *)sliderView
                     error:(NSError *_Nullable *_Nullable)error;

Swift

func bindAd(toSliderView sliderView: YMANativeAdView) throws

Parameters

sliderView

The slider’s root view.

error

Information about the error (for details, see YMANativeAdErrors.h).

sliderView

The slider’s root view.

error

Information about the error (for details, see YMANativeAdErrors.h).

Return Value

Result of setting (YES/NO).