Default App Inbox
Prerequisites
- SDK integration completed
enableAppInbox
config set totrue
during SDK initialization.
This is the quickest way to add App Inbox functionality to your iOS app. In this setup app will be using the default notification center view controller provided by the SDK for displaying inbox messages and managing them. You can also customize the appearance of the notification center view controller to match your app theme.
Pod Install
Starting from Castled iOS version 4.0.2
, AppInbox functionality is separated as a new module CastledInbox
. Add the module pod as dependency in the app pod file.
Save the Podfile and run the following command in the terminal to install the SDK:
Displaying App Inbox content
To facilitate the effortless display of App Inbox content, the SDK provides a default view controller: CastledInboxViewController
.
This controller is designed to showcase inbox cards and can be integrated within your app in two primary ways:
Using Navigation Controller
Embed CastledInboxViewController
within your existing navigation flow for a consistent user experience.
Using a Modal
Present the App Inbox cards in a modal view, suitable for focused interactions.
Handling Inbox Item Selection
To effectively capture and act upon interactions with App Inbox items, SDK offers the CastledInboxViewControllerDelegate
protocol.
By adopting this protocol, you can tap into the callback provided when a user selects an item from the inbox.
Integration Steps:
- Ensure your view controller conforms to the
CastledInboxViewControllerDelegate
protocol. - Implement the
didSelectedInboxWith((\_:buttonAction:, inboxItem:)
delegate method.
Customising App Inbox Display
Retrieving Unread Message Count
The SDK offers multiple methods to obtain the count of unread messages, suitable for display purposes. Developers can choose from the following options based on their specific use-case:
Approach 1 : Listener Approach
Approach 2 : Direct call
Dismiss App Inbox
Use the method below to dismiss the App Inbox programmatically.