For creating a wrapper, you can follow this small guide: Creating a Wrapper.
This method below will add an ad to the provided wrapper
import UIKit import R89SDK class ViewController: UIViewController { ... @IBOutlet weak var adContainer: UIView! ... override func viewDidLoad() { super.viewDidLoad() ... RefineryAdFactory.shared.createBanner( configurationID: ConfigBuilder.companion.BANNER_TEST_R89_CONFIG_ID, wrapper: adContainer, lifecycleCallbacks: nil) } ... } |
Your They can be many or none depending on your requests, if you need one or more please request them to your account manager or technical account manager. |
You can subscribe to these events with the same method by passing a new instance of BannerEventListener
as a lifecycleCallbacks
parameter to the createBanner
method. Details about this object can be found in the Reference.
First, extend from the BannerEventListener
. Here is what the implementation looks like.
class BannerEventLogger: BannerEventListener { override func onLayoutChange(width: Int32, height: Int32) { print("onLayoutChange","width=\(width)","height=\(height)") } override func onLoaded() { print("onLoaded") } override func onOpen() { print("onOpen") } override func onClick() { print("onClick") } override func onClose() { print("onClose") } override func onImpression() { print("onImpression") } override func onFailedToLoad(error: R89LoadError) { print("onFailedToLoad","error=\(error)") } } |