NativeAd
@objcMembers
public class NativeAd : NSObject, CacheExpiryDelegate
Represents a native ad and handles its various properties and functionalities.
-
The native ad markup containing the ad assets.
Declaration
Swift
public var nativeAdMarkup: NativeAdMarkup?
-
The delegate to receive native ad events.
Declaration
Swift
public weak var delegate: NativeAdEventDelegate?
-
Returns an array of titles from the native ad markup.
Declaration
Swift
@objc public var titles: [NativeTitle] { get }
-
Returns an array of data objects from the native ad markup.
Declaration
Swift
@objc public var dataObjects: [NativeData] { get }
-
Returns an array of images from the native ad markup.
Declaration
Swift
@objc public var images: [NativeImage] { get }
-
Returns an array of event trackers from the native ad markup.
Declaration
Swift
@objc public var eventTrackers: [NativeEventTrackerResponse]? { get }
-
Returns an array of data objects filtered by the specified data type.
Declaration
Swift
@objc public func dataObjects(of dataType: NativeDataAssetType) -> [NativeData]
-
Returns an array of images filtered by the specified image type.
Declaration
Swift
@objc public func images(of imageType: NativeImageAssetType) -> [NativeImage]
-
Returns the first title text from the native ad markup.
Declaration
Swift
@objc public var title: String? { get }
-
Returns the URL of the main image from the native ad markup.
Declaration
Swift
@objc public var imageUrl: String? { get }
-
Returns the URL of the icon image from the native ad markup.
Declaration
Swift
@objc public var iconUrl: String? { get }
-
Returns the sponsored by text from the native ad markup.
Declaration
Swift
@objc public var sponsoredBy: String? { get }
-
Returns the description text from the native ad markup.
Declaration
Swift
@objc public var text: String? { get }
-
Returns the call-to-action text from the native ad markup.
Declaration
Swift
@objc public var callToAction: String? { get }
-
Creates a
NativeAd
instance from the given cache ID.Declaration
Swift
public static func create(cacheId: String) -> NativeAd?
Parameters
cacheId
The cache ID to retrieve the bid response.
Return Value
A
NativeAd
instance if successful, otherwisenil
. -
Registers a view for tracking viewability and click events.
Declaration
Swift
@discardableResult public func registerView(view: UIView?, clickableViews: [UIView]?) -> Bool
Parameters
view
The view to register.
clickableViews
An array of views that should be clickable.
Return Value
true
if the view was successfully registered, otherwisefalse
.