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

# Custom App Inbox

In the preceding section, we discussed the configuration for utilizing the default notification center for displaying **App Inbox** messages.

For developers interested in implementing a custom View Controller for the App Inbox, the Castled SDK offers methods that facilitate the retrieval of messages for display. Additionally, the SDK provides essential methods for managing key lifecycle events.

```swift swift
// Fetching the unread message count directly
CastledInbox.sharedInstance.getInboxUnreadCount()

// Listening to unread message count changes using a callback
CastledInbox.sharedInstance.observeUnreadCountChanges(listener: { unreadCount in
    print("Inbox unread count is \(unreadCount)")
})

// Retrieving all inbox items
CastledInbox.sharedInstance.getInboxItems(completion: { result in
    print("Inbox items are \(result)")
})

// Logging read inbox items
CastledInbox.sharedInstance.logInboxItemsRead(inboxItems)

// Deleting a specific inbox item
CastledInbox.sharedInstance.deleteInboxItem(inboxItem)

// Logging a click on an inbox item
CastledInbox.sharedInstance.logInboxItemClicked(inboxItem, buttonTitle: "title")
```

```objc objc
// Fetching the unread message count using a callback
[[CastledInbox sharedInstance] inboxUnreadCountWithListener:^(NSInteger unreadCount) {
    NSLog(@"Inbox unread count is %ld", (long)unreadCount);
}];

// Retrieving all inbox items
[[CastledInbox sharedInstance] getInboxItemsWithCompletion:^(NSArray<CastledInboxItem *> * _Nullable inboxItems) {
    NSLog(@"Inbox items are %@", inboxItems);
}];

// Logging read inbox items
[[CastledInbox sharedInstance] logInboxItemsRead:inboxItems];

// Deleting a specific inbox item
[[CastledInbox sharedInstance] deleteInboxItem:inboxItem];

// Logging a click on an inbox item
[[CastledInbox sharedInstance] logInboxItemClicked:inboxItem buttonTitle:@"title"];

```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.