Skip to main content

SwiftUI support

The Swizzling technique used for tracking events in UIKit components does not work for SwiftUI components. As a result, the PAPulse SDK is unable to automatically track pa_click and pa_open events in SwiftUI in the same manner as it does for UIKit.

To address this limitation, the PAPulse SDK offers a SwiftUI native API based on view methods logClick() and logOpen(). These methods can be used as a substitute for the automatic events, allowing you to manually track pa_click and pa_open events in SwiftUI components.

var body: some View {
VStack {
Button("Submit") {
print("do work")
}
.logClick(trackingName: "button-sumbmit")

Text("Price")
.logClick(trackingName: "label-price")
}
.logOpen(trackingName: "test-open")
}