<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreAI",
  "identifier" : "/documentation/CoreAI/AIModelAsset/updateMetadata(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core AI"
    ],
    "preciseIdentifier" : "s:11CoreAIAsset12AIModelAssetV14updateMetadatayyyAC0F0VzKXEKF"
  },
  "title" : "updateMetadata(_:)"
}
-->

# updateMetadata(_:)

Updates the asset metadata.

```
mutating func updateMetadata(_ updates: (inout AIModelAsset.Metadata) throws -> Void) throws
```

## Discussion

Pass a closure that takes the existing metadata and updates it. After the closure executes,
this method writes the new metadata to the model asset on disk.

## Example

```swift
var asset = try AIModelAsset(contentsOf: input)
try asset.updateMetadata { metadata in
  metadata.author = "Alice"
  metadata.description = "An example model"
  metadata["iterations"] = 1000 // Custom metadata
}
```

---

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)