Skip to main content

🚩 Events & 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;
}

// Add the custom action called implementation
func customActionCalled(_ customAction: String) {
if (customAction == "MAGIC_ACTION") {
print("Magic action got called.")
}
}

func feedbackSent(_ data: [AnyHashable : Any]) {
// Feedback got sent with data
}

func feedbackSendingFailed() {
// Sending feedback failed
}

func feedbackWillBeSent() {
// The feedback will be sent
}
}