> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gleap.io/llms.txt
> Use this file to discover all available pages before exploring further.

# 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.

```swift theme={null}
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 notificationCountUpdated(_ count: Int32) {
        NSLog("Notification count updated. %i", count);
    }

    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)
    }
}
```

##
