---
title: "iOS SDK: Callbacks"
description: "Handle widget events and lifecycle callbacks with the Gleap iOS SDK. Follow the integration code examples."
url: https://docs.gleap.ai/en/articles/436-ios-sdk-callbacks
collection: "iOS"
updated: 2026-11-01
language: en
---

# iOS SDK: Callbacks

Handle widget events and lifecycle callbacks with the Gleap iOS SDK. Follow the integration code examples.

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

## Related

- [iOS SDK setup](https://docs.gleap.ai/en/articles/434-ios-sdk-setup.md)
- [iOS SDK: User identity](https://docs.gleap.ai/en/articles/435-ios-sdk-user-identity.md)
- [iOS SDK: Frontend tools](https://docs.gleap.ai/en/articles/437-ios-sdk-frontend-tools.md)
- [iOS SDK: Forms](https://docs.gleap.ai/en/articles/438-ios-sdk-forms.md)
- [iOS SDK: Feedback button](https://docs.gleap.ai/en/articles/439-ios-sdk-feedback-button.md)
