Install SDK

1. Introduction

This guide provides a comprehensive walkthrough for integrating the MyChips SDK into your iOS application, enabling the display of an engaging offerwall.

2. SDK Integration

In your project in Xcode go to File -> Add Package Dependencies and then add the dependency using the following repo:

Now in your project you can import the SDK:

import MyChipsSdk

3. Initializating the SDK

Before using the sdk or showing the offerwall you must initialize it:

//replace "YOUR_API_KEY"
let _ = MCOfferwallSDK(apiKey: "YOUR_API_KEY")

3.1 (Optional) Set userId if you have your own unique id

MCOfferwallSDK.setUserId(userId: "YOUR_USER_ID")

Obtain your API key and User ID from Universal Developer Portal

4. Displaying the Offerwall

To display the offerwall we provide you with a UIViewController which you can integrate into UIKit or SwiftUI project.

To show the offerwall you need to provide your AdUnitId and a closure which closes the offerwall.

// below is an example of a view controller which you
// can load into your scene and open the offerwall
// on a button press

class FirstViewController: UIViewController {
    override func loadView() {
        // Create a new UIView instance
        let view = UIView()
        view.backgroundColor = .white // Set background color
        // Create and configure the button
        let nextButton = UIButton(type: .system)
        nextButton.setTitle("Show Offerwall", for: .normal)
        nextButton.addTarget(self, action: #selector(showOfferwall), for: .touchUpInside)
        nextButton.translatesAutoresizingMaskIntoConstraints = false // Disable default autoresizing mask
        // Add the button to the view
        // Add constraints for button
            nextButton.centerXAnchor.constraint(equalTo: view.centerXAnchor),
            nextButton.centerYAnchor.constraint(equalTo: view.centerYAnchor)
        // Set the view of the view controller
        self.view = view

    @objc func showOfferwall() {
        let mcWebView = MCWebViewController(
            adunitId: "YOUR_AD_UNIT_ID",
            onClose: {
                self.navigationController?.popViewController(animated: true)
        self.navigationController?.pushViewController(mcWebView, animated: true)

Your Ad unit ID can be found here

Last updated