Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

There are two options available to track the advertisement events for the infinite scroll. You can subscribe to these events with the same method but passing a new object as a parameter. Details about this object can be found in the Reference.

Code Block
languageswift
import UIKit
import R89SDK

// 1. Extend from the Banner InfiniteScrollEventListener
class InfiniteScrollLifecycleListener: InfiniteScrollEventListener {
    ...
    override func onAdItemLoaded(itemIdInData: Int32) {
        // Ad has been loaded for the position (itemIdInData)
    }
    ...
}

class ViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
 
    var collectionView: UICollectionView!
    ...
    override func viewDidLoad() {
        super.viewDidLoad()
        // Configure the collection view layout
        ...
        let infiniteScrollConfigId = ConfigBuilder.companion.INFINITE_SCROLL_TEST_R89_CONFIG_ID
        RefineryAdFactory.shared.createInfiniteScroll(
          configurationID: infiniteScrollConfigId,
          scrollView: self.collectionView,
          scrollItemAdWrapperTag: "infiniteScroll_ad_wrapper_tag",
          // 2. Pass the InfiniteScrollLifecycleListener instance via lifecycleCallbacks
          lifecycleCallbacks: InfiniteScrollLifecycleListener())
    }
    ...
}

Next, as an option