NativeAd

@objcMembers
public class NativeAd : NSObject, CacheExpiryDelegate

Represents a native ad and handles its various properties and functionalities.

Public properties

Array getters

  • 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 }

Filtered array getters

Property getters

  • 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, otherwise nil.

  • 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, otherwise false.