Content
The Content API lets you retrieve server-driven content items segmented by group, content key, and tags. The SDK provides the metadata; your application handles the actual downloading and rendering.
ContentItem shape
Each item returned by the API is a ContentItem struct:
Fetching a list of items
Use getContentList(groupKey:contentKey:tags:) to retrieve all items that match the given group key, content key, and an optional set of tags. Items must contain all specified tags to be included.
// All items in "banners" group with key "hero"
let items = magify.getContentList(groupKey: "banners", contentKey: "hero")
// Filtered by tags
let abItems = magify.getContentList(
groupKey: "banners",
contentKey: "hero",
tags: ["variant_a"]
)
Returns [ContentItem] — an empty array when no items match.
Fetching the earliest or latest item
The SDK recognises two reserved tags — "earliest" and "latest" — to let the server mark which item in a group should be served first or last.
// Item tagged "earliest"
if let first = magify.getEarliestContent(groupKey: "banners", contentKey: "hero") {
load(url: first.link)
}
// Item tagged "latest"
if let newest = magify.getLatestContent(groupKey: "banners", contentKey: "hero") {
load(url: newest.link)
}
Both methods return ContentItem? — nil when no matching item is found.
Working with ContentProvider directly
MagifyClient exposes the underlying ContentProvider as contentProvider. Use it when you need the subscript or groupForKey(_:) accessor for group-level operations:
if let group = magify.contentProvider["banners"] {
let item = group["hero"]
let all = group.itemsForKey("hero")
}
Next step
You have now completed the core Magify Swift SDK integration. For a list of all available API surfaces, refer to the platform documentation.