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 }
-
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, otherwisefalse
. -
Sets values of all ad assets to native ad view, installs impression and click handlers. The method is intended for use in Third-Party Mediation.
Declaration
Swift
@objc(bindAdToView:viewData:error:) func bindAd(to view: UIView, viewData: NativeAdViewData) throws
Parameters
view
Root ad view, superview for all asset views.
viewData
NativeAdViewData
with views for ad assets.error
Binding error. - seealso:
NativeAdErrorCode
for error codes.Return Value
true
if binding succeeded, otherwisefalse
. -
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, otherwisefalse
.