<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Progress/setUserInfoObject(_:forKey:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSProgress(im)setUserInfoObject:forKey:"
  },
  "title" : "setUserInfoObject(_:forKey:)"
}
-->

# setUserInfoObject(_:forKey:)

Sets a value in the user info dictionary.

```
func setUserInfoObject(_ objectOrNil: Any?, forKey key: ProgressUserInfoKey)
```

## Parameters

`objectOrNil`

The object to set for the specified key, or `nil` to remove an existing entry in the dictionary.

`key`

The key for storing the specified object.

## Discussion

Use this method to set a value in the [`userInfo`](/documentation/Foundation/Progress/userInfo) dictionary, with appropriate KVO notification for properties with values that can depend on values in the user info dictionary, like [`localizedDescription`](/documentation/Foundation/Progress/localizedDescription).

Supply a value of `nil` to remove an existing dictionary entry for a specified key.

---

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)