<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/NSPersistentStoreCoordinator/setMetadata(_:for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPersistentStoreCoordinator(im)setMetadata:forPersistentStore:"
  },
  "title" : "setMetadata(_:for:)"
}
-->

# setMetadata(_:for:)

Updates the metadata for the specified persistent store.

```
func setMetadata(_ metadata: [String : Any]?, for store: NSPersistentStore)
```

## Parameters

`metadata`

A dictionary containing metadata for the store.

`store`

A persistent store.

## Discussion

The store type and UUID (`NSStoreTypeKey` and `NSStoreUUIDKey`) are always added automatically, however `NSStoreUUIDKey` is only added if it is not set manually as part of the dictionary argument.

> Important:
> Setting the metadata for a store does not change the information on disk until the store is actually saved.

## See Also

[`+  setMetadata:forPersistentStoreOfType:URL:error:`](/documentation/CoreData/NSPersistentStoreCoordinator/setMetadata(_:forPersistentStoreOfType:at:))

Sets the metadata for a given store.

[`+  metadataForPersistentStoreOfType:URL:error:`](/documentation/CoreData/NSPersistentStoreCoordinator/metadataForPersistentStore(ofType:at:))

Returns a dictionary containing the metadata stored in the persistent store at a given URL.



---

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)