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 initialized() {
NSLog("Gleap got initialized and is ready.")
}

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

func feedbackFlowStarted(_ feedbackAction: [AnyHashable : Any]) {
NSLog("Form shown", feedbackAction)
}

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

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

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