---
title: "updateMetadata(_:)"
framework: coreai
role: symbol
role_heading: Instance Method
path: "coreai/aimodelasset/updatemetadata(_:)"
---

# updateMetadata(_:)

Updates the asset metadata.

## Declaration

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

## Discussion

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 var asset = try AIModelAsset(contentsOf: input) try asset.updateMetadata { metadata in   metadata.author = "Alice"   metadata.description = "An example model"   metadata["iterations"] = 1000 // Custom metadata }

## See Also

### Modifying an asset

- [removeDerivedArtifacts()](coreai/aimodelasset/removederivedartifacts().md)
