GuidesAPI ReferenceRelease Notes
HomeLog InHome
Guides

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

PropertyTypeDescription
dataSourceBlazeDataSourceType (required)The data source to fetch. Must be a fetchable case and may not itself be .composite — nesting is rejected at validation time.
configBlazeCompositeDataSourceConfigPer-entry options, e.g. whether this entry is mandatory. Defaults to BlazeCompositeDataSourceConfig().

BlazeCompositeDataSourceConfig

PropertyTypeDescription
isMandatoryBoolWhen 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

  • dataSources must not be empty.
  • No entry's dataSource may itself be .composite (no nesting).
  • Every entry must be a fetchable BlazeDataSourceType case. CMS-configured widgets are not a data source — they use widgetRemoteIdentifier at widget initialization, so they cannot be a composite entry. See CMS-configured widgets.

Did this page help you?