Banner

public class Banner

This class represents a Banner Ad format.

You call the static method create(placementId:size:viewController:test:verbose:) to create a new banner instance.

  • The placement Id for this banner.

    Declaration

    Swift

    public let placementId: String
  • The object that acts as the delegate of the banner.

    The delegate must adopt the BannerDelegate protocol. The delegate is not retained.

    Declaration

    Swift

    public weak var delegate: BannerDelegate?
  • The banner view that should be added to the view hierarchy.

    The most common practice is to add the banner view to the view hierarchy either:

    • After creating the Banner instance.
    • After the didLoad(result:) delegate callback is called.

    Declaration

    Swift

    public var view: UIView { get }
  • The space in your app from where the ad will be shown (eg: dashboard, settings). Used for tracking.

    Declaration

    Swift

    public var adSpace: String? { get set }
  • Starts a new load call.

    After the banner loads successfully, the view should be added to the view hierarchy.

    Declaration

    Swift

    public func load(customProperties: CustomProperties = CustomProperties())

    Parameters

    customProperties

    An optional CustomProperties object containing custom properties, useful for tracking.

  • Updates the viewController required by some networks to be able to display a full sized ad when a banner is clicked.

    You would usually update the viewController with this method if you passed nil on the viewController parameter of create(placementId:size:viewController:test:verbose:), or if you moved your banner view into the view hierarchy of a new viewController.

    Declaration

    Swift

    public func set(viewController: UIViewController)

    Parameters

    viewController

    a new viewController.

  • Creates a new instance of a Banner.

    Declaration

    Swift

    public static func create(placementId: String,
                              size: Banner.Size,
                              viewController: UIViewController? = nil,
                              test: Bool = false,
                              verbose: Bool = false) -> Banner

    Parameters

    placementId

    A string containing a valid placement id.

    size

    Size of the banner. See Size for the available sizes.

    viewController

    Some networks require a viewController to be able to display a full sized ad when a banner is clicked.

    test

    Whether a test banner should be loaded. This is only for testing purposes, should be false on production builds.

    verbose

    Enable logging for this banner instance. This is only for debugging purposes, should be false on production builds.

    Return Value

    A Banner instance ready to load.