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
BannerDelegateprotocol. 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
Bannerinstance. - After the
didLoad(result:)delegate callback is called.
Declaration
Swift
public var view: UIView { get } - After creating the
-
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
viewshould be added to the view hierarchy.Declaration
Swift
public func load(customProperties: CustomProperties = CustomProperties())Parameters
customPropertiesAn optional
CustomPropertiesobject 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 bannerviewinto the view hierarchy of a new viewController.Declaration
Swift
public func set(viewController: UIViewController)Parameters
viewControllera 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) -> BannerParameters
placementIdA string containing a valid placement id.
sizeSize of the banner. See
Sizefor the available sizes.viewControllerSome networks require a viewController to be able to display a full sized ad when a banner is clicked.
testWhether a test banner should be loaded. This is only for testing purposes, should be false on production builds.
verboseEnable logging for this banner instance. This is only for debugging purposes, should be false on production builds.
Return Value
A
Bannerinstance ready to load.