RewardedAds
public class RewardedAds
This class is the entry point for displaying rewarded ads.
To start, load an rewarded ad by providing a valid placement id in the
load(placementId:)
method.
Note: Only one call to rewarded ad load per placement id is needed. Subsequent calls with the same placement id will be ignored.
-
Adds a delegate for handling all rewarded ads events.
The delegate must adopt the
RewardedAdsDelegate
protocol. The delegate is not retained.Declaration
Swift
public func addDelegate(_ delegate: RewardedAdsDelegate)
Parameters
delegate
the delegate that will listen to all rewarded ad events.
-
Removes a delegate that was previously handling rewarded ads events.
Declaration
Swift
public func removeDelegate(_ delegate: RewardedAdsDelegate)
Parameters
delegate
the delegate to be removed.
-
Starts loading a new rewarded 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 a rewarded 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 a rewarded 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 rewarded 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 rewarded 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 rewarded 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 rewarded 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.