Contents

updateMetadata(_:)

Updates the asset metadata.

Declaration

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

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