Skip to content


Content Card integration

Content Cards data model

The Content Cards data model is available in the iOS SDK.

Getting the data

To access the Content Cards data model, subscribe to Content Cards update events:

1
2
3
4
5
6
// Subscribe to Content Cards updates
// Note: you should remove the observer where appropriate
[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(contentCardsUpdated:)
                                             name:ABKContentCardsProcessedNotification
                                           object:nil];
1
2
3
4
5
6
7
// Called when Content Cards are refreshed (via `requestContentCardsRefresh`)
- (void)contentCardsUpdated:(NSNotification *)notification {
  BOOL updateIsSuccessful = [notification.userInfo[ABKContentCardsProcessedIsSuccessfulKey] boolValue];
  if (updateIsSuccessful) {
    // get the cards using [[Appboy sharedInstance].contentCardsController getContentCards];
  }
}
1
2
3
4
5
// Subscribe to content card updates
// Note: you should remove the observer where appropriate
NotificationCenter.default.addObserver(self, selector:
  #selector(contentCardsUpdated),
  name:NSNotification.Name.ABKContentCardsProcessed, object: nil)
1
2
3
4
5
6
7
8
// Called when the Content Cards are refreshed (via `requestContentCardsRefresh`)
@objc private func contentCardsUpdated(_ notification: Notification) {
  if let updateIsSuccessful = notification.userInfo?[ABKContentCardsProcessedIsSuccessfulKey] as? Bool {
    if (updateIsSuccessful) {
      // get the cards using Appboy.sharedInstance()?.contentCardsController.contentCards
    }
  }
}

If you want to change the card data after it’s been sent by Braze, we recommend storing a deep copy of the card data locally, updating the data, and displaying it yourself. The cards are accessible via ABKContentCardsController.

Content Card model

Braze offers three Content Card types: banner, captioned image, and classic. Each type inherits common properties from a base ABKContentCard class and has the following additional properties.

Base Content Card model properties - ABKContentCard

Captioned image Content Card properties - ABKCaptionedImageCard

Classic Content Card properties - ABKClassicContentCard

Card methods

For more details, refer to the class reference documentation

Content Cards view controller integration

Content Cards can be integrated with two view controller contexts: navigation or modal.

Example of pushing a ABKContentCardsTableViewController instance into a navigation controller:

1
2
3
4
ABKContentCardsTableViewController *contentCards = [[ABKContentCardsTableViewController alloc] init];
contentCards.title = @"Content Cards Title";
contentCards.disableUnreadIndicator = YES;
[self.navigationController pushViewController:contentCards animated:YES];
1
2
3
4
let contentCards = ABKContentCardsTableViewController()
contentCards.title = "Content Cards Title"
contentCards.disableUnreadIndicator = true
navigationController?.pushViewController(contentCards, animated: true)

This modal is used to present the view controller in a modal view, with a navigation bar on top and a Done button on the side of the bar.

1
2
3
4
ABKContentCardsViewController *contentCards = [[ABKContentCardsViewController alloc] init];
contentCards.contentCardsViewController.title = @"Content Cards Title";
contentCards.contentCardsViewController.disableUnreadIndicator = YES;
[self.navigationController presentViewController:contentCards animated:YES completion:nil];
1
2
3
4
let contentCards = ABKContentCardsViewController()
contentCards.contentCardsViewController.title = "Content Cards Title"
contentCards.contentCardsViewController.disableUnreadIndicator = true
self.present(contentCards, animated: true, completion: nil)

For view controller examples, check out our Content Cards sample app.

HOW HELPFUL WAS THIS PAGE?
New Stuff!