Integrating Uptick Digital Advertising Widget into Your Swift iOS Application

Enhance your Swift iOS app by seamlessly integrating our advertising widget. The setup is quick and consists of a few core steps. By following this guide, you can embed the widget and showcase targeted advertising to your audience.

Step 1: Installing Uptick SDK

First, you’ll need to install the Uptick SDK, which provides the necessary tools for integrating our advertising widget into your iOS application.

Add the SDK to your Podfile:

pod 'UptickSDK'

Install the pod:

pod install

Step 2: Setting Up the Placeholder View

Next, you need to set up a placeholder where the advertising widget will appear. Add a UIView to your storyboard or create it programmatically.

Storyboard Example:

  • Open your storyboard.
  • Drag a UIView to the desired location in your view controller.
  • Set the class of this UIView to UptickAdView in the Identity Inspector.

Programmatic Example:

import UIKit
import UptickSDK

class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()

        let uptickAdView = UptickAdView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 250))
        uptickAdView.backgroundColor = .clear
        self.view.addSubview(uptickAdView)
    }
}

Step 3: Embedding the Activation Script

After setting up your placeholder, you need to embed the activation script to power the widget and fetch the required content.

Storyboard Example:

Ensure you have a reference to the UptickAdView in your view controller.

import UIKit
import UptickSDK

class ViewController: UIViewController {
    @IBOutlet weak var uptickAdView: UptickAdView!

    override func viewDidLoad() {
        super.viewDidLoad()
        UptickManager.shared.activateAd(in: uptickAdView, withID: "YOUR_INTEGRATION_ID")
    }
}

Programmatic Example:

import UIKit
import UptickSDK

class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()

        let uptickAdView = UptickAdView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 250))
        uptickAdView.backgroundColor = .clear
        self.view.addSubview(uptickAdView)

        UptickManager.shared.activateAd(in: uptickAdView, withID: "YOUR_INTEGRATION_ID")
    }
}

Step 4: Activating Uptick Promotion

To display the Uptick Widget, ensure that the widget is activated within your view controller. This can be done in the viewDidLoad method or when the view appears.

import UIKit
import UptickSDK

class ThankYouViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()

        let uptickAdView = UptickAdView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 250))
        uptickAdView.backgroundColor = .clear
        self.view.addSubview(uptickAdView)

        UptickManager.shared.activateAd(in: uptickAdView, withID: "YOUR_INTEGRATION_ID")
    }
}

Full Example

Here is a complete example of a ThankYouViewController that integrates the Uptick advertising widget.

import UIKit
import UptickSDK

class ThankYouViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()

        let uptickAdView = UptickAdView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 250))
        uptickAdView.backgroundColor = .clear
        self.view.addSubview(uptickAdView)

        UptickManager.shared.activateAd(in: uptickAdView, withID: "YOUR_INTEGRATION_ID")
    }
}

Troubleshooting Tips

  • Layout Issues: If you encounter any layout disruptions, confirm that you’ve correctly placed the UptickAdView and used the appropriate integration ID.
  • Support: If issues persist, reach out to our technical support team for further assistance.