AdCompanionViewDelegate
@objc(AASDKAdCompanionViewDelegate)
public protocol AdCompanionViewDelegate
The AdCompanionViewDelegate
protocol defines delegate methods to communicate changes in the lifecycle of AdCompanionView
instances.
-
Called when the
AdCompanionView
is about to load its content.Declaration
Swift
@objc optional func adCompanionViewWillLoad(_ adCompanionView: AdCompanionView)
Parameters
adCompanionView
The
AdCompanionView
instance that triggers the ad request -
Called when the companion has started to be displayed on screen.
Declaration
Swift
@objc optional func adCompanionViewDidDisplay(_ adCompanionView: AdCompanionView)
Parameters
adCompanionView
The
AdCompanionView
instance that displayed the ad content -
Called when an ad request failed. Failure is normally due to network connectivity issues.
Declaration
Swift
@objc optional func adCompanionView(_ adCompanionView: AdCompanionView, didFailToDisplay error: Error)
Parameters
adCompanionView
The
AdCompanionView
instance that failed to displayerror
The error received
-
Called when the companion view ends displaying.
Declaration
Swift
@objc optional func adCompanionViewDidEndDisplay(_ adCompanionView: AdCompanionView)
Parameters
adCompanionView
The
AdCompanionView
instance that ended displaying -
Called immediately when a touch event is detected over the ad companion view. It gives your application a chance to override the default behavior when a
clickThrough
event occurs. Returntrue
if you want your application to handle the targetURL. Otherwise, returnfalse
, in which case the targetURL will be opened in the external browser.Declaration
Swift
@objc optional func adCompanionView(_ adCompanionView: AdCompanionView, shouldOverrideCompanionClickThrough url: URL) -> Bool
Parameters
adCompanionView
The
AdCompanionView
instance that received the touch eventurl
The
URL
that was loaded by theAdCompanionView
-
Called when the application is about to go to the background as a result of a
clickThrough
event and the targetURL is opened in the external browser.Declaration
Swift
@objc optional func adCompanionViewWillLeaveApplication(_ adCompanionView: AdCompanionView)
Parameters
adCompanionView
The
AdCompanionView
instance that triggers the event