<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSUbiquitousKeyValueStore/set(_:forKey:)-9vmlm",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSUbiquitousKeyValueStore(im)setDictionary:forKey:"
  },
  "title" : "set(_:forKey:)"
}
-->

# set(_:forKey:)

Sets the value of the specified key to a dictionary of property list objects.

```
func set(_ aDictionary: [String : Any]?, forKey aKey: String)
```

## Parameters

`aDictionary`

The dictionary object to save in the iCloud key-value store. The dictionary
must contain only property list types.

`aKey`

The key to associate with the value.

## Discussion

---

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)