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.
https://github.com/uptick-ads/uptick-ios
import UIKit import UptickSDK class ViewController: UIViewController { // Create a variable for the uptickAdView lazy var uptickAdView = UptickAdView() override func viewDidLoad() { super.viewDidLoad() // Add the uptickAdView to your main view view.addSubview(uptickAdView) // When you want to show the offer flow UptickManager.shared.activateAd( in: uptickAdView, withID: "AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE", parameters: ["placement": "sdk_order_confirmation"] ) } }
UptickAdView
and used the appropriate integration ID.
There are some events and properties you can access to customize the SDK to better fit your application.
There is a public closure that occurs when the offers are closed or completed. In any event where they dissapear from the screen. You can subscribe to this and have the possibility to update your layout.
import UIKit import UptickSDK class ViewController: UIViewController { func setProperties() { UptickManager.shared.onDisappearOffer = { self.showButton.isHidden = false self.defaultButton.isHidden = false self.backgroundView.isHidden = true self.uptickAdView.removeFromSuperview() } } }
We have a public closure that occurs when the offer is received. This may be used to inspect the size of the offer’s frame and dynamically size anything that you need too.
import UIKit import UptickSDK class ViewController: UIViewController { func setProperties() { UptickManager.shared.onReceivedOffer = { offer in print("Received Offer: \(offer.frame.width)x\(offer.frame.height)") if (offer.isLast) { offer.rejectButton.isHidden = true } } } }
The offer
received is a type UptickData.Offer
and has these properties
public enum UptickData { public class Offer : NSObject { // Returns the ID of the offer public let id: String // Returns the position of the offer public let position: Int? // Returns the total offers in the flow public let total: Int? // Returns the frame of the offer view public let frame: CGRect // Returns the reject button public let rejectButton: UIButton } }