<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MediaIntelligence",
  "identifier" : "/documentation/MediaIntelligence/FaceGroupAnalyzer/insertOrUpdateAssets(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Media Intelligence"
    ],
    "preciseIdentifier" : "s:17MediaIntelligence17FaceGroupAnalyzerC20insertOrUpdateAssetsyQrSayAA0aB10ImageAssetVGYaKF"
  },
  "title" : "insertOrUpdateAssets(_:)"
}
-->

# insertOrUpdateAssets(_:)

Adds or replaces image assets in the analyzer.

```
final nonisolated(nonsending) func insertOrUpdateAssets(_ assets: [MediaIntelligenceImageAsset]) async throws -> some AsyncSequence<(assetID: MediaIntelligenceImageAsset.ID, faces: Array<FaceGroupAnalyzer.Face>), any Error>
```

## Parameters

`assets`

The image assets to ingest.

## Return Value

An async sequence of `(assetID, faces)` pairs — one per
asset — reporting the faces detected in each image.

## Discussion

For each asset, the method detects faces and extracts facial data,
then persists the results to the working directory. If an asset
with the same identifier already exists, the method replaces its
face data.

After this call, [`state`](/documentation/MediaIntelligence/FaceGroupAnalyzer/state-swift.property) becomes
[`FaceGroupAnalyzer.State.stale`](/documentation/MediaIntelligence/FaceGroupAnalyzer/State-swift.enum/stale) until you call
[`update(subprogress:)`](/documentation/MediaIntelligence/FaceGroupAnalyzer/update(subprogress:)). Faces detected in this
call have a `nil` [`entityID`](/documentation/MediaIntelligence/FaceGroupAnalyzer/Face/entityID) until
clustering runs.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)