Content
AFCore.content() reads the member's personalized, content-managed surfaces -- bottom navigation, home banners and the Explore menu -- so your app's navigation and promotions can change from the CMS without an app release. Content comes localized, already filtered to what the member is entitled to, with typed actions and image URLs.
What you can do
- Build the bottom navigation from the member's configured tabs.
- Show a home banner carousel with images cropped to a consistent shape, captions and calls to action.
- Render the Explore menu as titled sections of cards, tiles and list rows.
- Route every tap through a typed action or target: an in-app screen, a web page, a care path or a content entry.
- Request content in a specific locale, such as
es-US, or the member's default.
Key APIs
| Call | What it is for |
|---|---|
content().getToolbar(locale) | Bottom navigation tabs (ContentPage) |
content().getBanners(locale) | Home banner slides (ContentPage) |
content().getMenu(locale) | The Explore menu page (ContentMenuPage), or null |
content().getContent(placement, surfaceCode, locale) | Any placement and surface |
ContentMedia.url(rendition) | An image URL in the rendition you need, such as CARD or BANNER_16X9 |
Example
- Android (Kotlin)
- iOS (Swift)
val slides = AFCore.content().getBanners(locale = null).items
slides.forEach { slide ->
addSlide(
imageUrl = slide.bannerMedia?.url(ContentImageRendition.BANNER_16X9),
caption = slide.overlayCaption,
link = slide.actionUrl,
)
}
val menu = AFCore.content().getMenu(locale = null) ?: return
menu.sections.forEach { section ->
section.entries.forEach { entry ->
when (entry.target?.kind) {
ContentTargetKind.INTERNAL_ROUTE -> addTile(entry.label) { navigate(entry.target?.routeKey) }
ContentTargetKind.EXTERNAL_URL -> addTile(entry.label) { openWeb(entry.target?.url) }
else -> Unit
}
}
}
let slides = try await AFCore.shared.content().getBanners(locale: nil).items
for slide in slides {
addSlide(imageUrl: slide.bannerMedia?.url(rendition: .banner16x9),
caption: slide.overlayCaption,
link: slide.actionUrl)
}
guard let menu = try await AFCore.shared.content().getMenu(locale: nil) else { return }
for section in menu.sections {
for entry in section.entries {
guard let target = entry.target else { continue }
switch target.kind {
case .internalRoute: addTile(entry.label) { navigate(target.routeKey) }
case .externalUrl: addTile(entry.label) { openWeb(target.url) }
default: break
}
}
}
Good to know
- An empty page (or a
nullmenu) means "show nothing" -- never fall back to showing every feature. A failed read throwsAFException; show an error with a retry. - Images are public: load them without an
Authorizationheader. userInterface()(getBottomNavigationItems(),getMenuItems(),getBannerImages(), tray notifications) keeps working unchanged, so you can move one surface at a time. Tray notifications stay onuserInterface().
Learn more
See the API Reference for ContentItem, ContentMenuPage and ContentTarget. Complete integration guides are in AIDE Docs.