InterstitialAds
public class InterstitialAds
This class is the entry point for displaying interstitial ads.
To start, load an interstitial ad by providing a valid placement id in the
load(placementId:)
method.
Note: Only one call to interstitial load per placement id is needed. Subsequent calls with the same placement id will be ignored.
-
Adds a delegate for handling all interstitial ads events.
The delegate must adopt the
InterstitialAdsDelegate
protocol. The delegate is not retained.Declaration
Swift
public func addDelegate(_ delegate: InterstitialAdsDelegate)
Parameters
delegate
the delegate that will listen to all interstitial ad events.
-
Removes a delegate that was previously handling interstitial ads events.
Declaration
Swift
public func removeDelegate(_ delegate: InterstitialAdsDelegate)
Parameters
delegate
the delegate to be removed.
-
Starts loading a new interstitial ad.
After the first call, no more calls to this method are needed, as the ad will reload automatically.
Declaration
Swift
public func load(placementId: String)
Parameters
placementId
The placement id of the ad to be loaded.
-
Indicates if there is an interstitial ad ready to be presented for any placement id.
Declaration
Swift
public func isReady() -> Bool
Return Value
true if an ad is ready to be presented.
-
Indicates if an interstitial ad for the placement id is ready to be presented.
Declaration
Swift
public func isReady(withPlacementId placementId: String) -> Bool
Parameters
placementId
The placement id of the ad.
Return Value
true if an ad is ready to be presented.
-
Presents a previously loaded interstitial ad for any placement id.
If multiple ads with different placement ids were previously loaded, the sdk will try to present the best one available.
Declaration
Swift
public func present(fromViewController viewController: UIViewController)
Parameters
viewController
A view controller to present the ad.
-
Presents a previously loaded interstitial ad for any placement id.
If multiple ads with different placement ids were previously loaded, the sdk will try to present the best one available.
Declaration
Swift
public func present(fromViewController viewController: UIViewController, fromAdSpace adSpace: String)
Parameters
viewController
A view controller to present the ad.
adSpace
The space in your app from where the ad will be shown (eg: dashboard, settings). Used for tracking.
-
Presents a previously loaded interstitial for the placement id.
Declaration
Swift
public func present(withPlacementId placementId: String, fromViewController viewController: UIViewController)
Parameters
placementId
The placement id of the ad.
viewController
A view controller to present the ad.
-
Presents a previously loaded interstitial for the placement id.
Declaration
Swift
public func present(withPlacementId placementId: String, fromViewController viewController: UIViewController, fromAdSpace adSpace: String)
Parameters
placementId
The placement id of the ad.
viewController
A view controller to present the ad.
adSpace
The space in your app from where the ad will be shown (eg: dashboard, settings). Used for tracking.