BlazeDataSourceType.composite - iOS
.composite combines multiple independent data sources into a single, deduplicated feed. Each entry is fetched independently and in parallel, then merged in declaration order with first-occurrence-wins deduplication by item ID.
let dataSource: BlazeDataSourceType = .composite(dataSources: [
BlazeCompositeDataSourceEntry(
dataSource: .labels(label: .mustInclude("football")),
config: BlazeCompositeDataSourceConfig(isMandatory: true)
),
BlazeCompositeDataSourceEntry(
dataSource: .ids(ids: ["id1", "id2"])
)
])BlazeCompositeDataSourceEntry
BlazeCompositeDataSourceEntry| Property | Type | Description |
|---|---|---|
dataSource | BlazeDataSourceType (required) | The data source to fetch. Must be a fetchable case and may not itself be .composite — nesting is rejected at validation time. |
config | BlazeCompositeDataSourceConfig | Per-entry options, e.g. whether this entry is mandatory. Defaults to BlazeCompositeDataSourceConfig(). |
BlazeCompositeDataSourceConfig
BlazeCompositeDataSourceConfig| Property | Type | Description |
|---|---|---|
isMandatory | Bool | When true, a fetch failure for this entry fails the entire composite. An empty success (0 items returned) is not treated as a failure. When false (default), a failure is silently skipped as long as at least one other entry succeeds. |
Behavior
- All entries are fetched in parallel.
- Results are merged in declaration order; the first occurrence of a duplicate item ID wins.
- If a mandatory entry fails, the entire composite fetch fails. Non-mandatory entry failures are skipped.
- If all entries fail, the composite fetch fails regardless of the mandatory flag.
- Read/unread ordering (when applicable) is applied to the final merged list, not per-entry.
Limitations
dataSourcesmust not be empty.- No entry's
dataSourcemay itself be.composite(no nesting). - Every entry must be a fetchable
BlazeDataSourceTypecase. CMS-configured widgets are not a data source — they usewidgetRemoteIdentifierat widget initialization, so they cannot be a composite entry. See CMS-configured widgets.
Updated 22 days ago
Did this page help you?
