Skip to main content

🚩 Callbacks

Use our GleapDelegate to get notified on certain state changes of the Gleap widget. This enables you to create an even deeper integration with Gleap.

import Foundation
import UIKit
import Gleap

// Add the GleapDelegate protocol to your view controller
class DemoViewController: UIViewController, GleapDelegate {

override func viewDidLoad() {
// Assign self to the delegate
Gleap.sharedInstance().delegate = self;
}

func widgetClosed() {
NSLog("Closed widget.")
}

func widgetOpened() {
NSLog("Opened widget.")
}

func feedbackFlowStarted(_ feedbackAction: [AnyHashable : Any]) {
NSLog("Started feedback flow", feedbackAction)
}

func feedbackSendingFailed() {
NSLog("Sending feedback failed")
}

func feedbackSent(_ data: [AnyHashable : Any]) {
NSLog("Feedback sent", data)
}

func customActionCalled(_ customAction: String) {
NSLog(customAction)
}
}