Appearance
View Initialization
swift
func initView(_ viewId: String)Description
Informs the SDK that the current view or screen in the app has changed. The viewId must be a unique, persistent string identifier for the specific screen, typically a UIViewController. Currently, initView is used to manage the pos (position) counter:
When a new viewId is initialized, the pos counter starts at 1. If a previously used viewId is passed again, the pos counter resumes from its last state for that viewId.
Usage Guidelines
- Unique Identifier: Ensure viewId is unique and consistent for each screen to maintain proper state management.
- ntext Requirement: Call within a UIViewController.
- Integration with activateContext: Call initView alongside activateContext when handling view changes or reloads.
Example
swift
import RingierAd
class MyViewController: UIViewController {
let uniqueViewId = UUID().uuidString // Persistent unique string
override func viewDidLoad() {
super.viewDidLoad()
// Initialize the view with the SDK
RingierAd.initView(uniqueViewId)
// Activate context with keywords
let keywords = RingierAd.Keywords(/* your keywords */)
RingierAd.activateContext(keywords: keywords, correlator: RingierAdCorrelator.generate(), contextUrl: "https://example.com/screen")
}
}
