<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSDictionary/description(withLocale:indent:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDictionary(im)descriptionWithLocale:indent:"
  },
  "title" : "description(withLocale:indent:)"
}
-->

# description(withLocale:indent:)

Returns a string object that represents the contents of the dictionary, formatted as a property list.

```
func description(withLocale locale: Any?, indent level: Int) -> String
```

## Parameters

`locale`

An object that specifies options used for formatting each of the dictionary’s keys and values; pass `nil` if you don’t want them formatted.

    On iOS and macOS 10.5 and later, either an instance of     `NSDictionary`     or an     `NSLocale`     object may be used for     `locale`    . In OS X v10.4 and earlier it must be an instance of     `NSDictionary`    .

`level`

Specifies a level of indentation, to make the output more readable: the indentation is (4 spaces) * `level`.

## Return Value

A string object that represents the contents of the dictionary, formatted as a property list.

## Discussion

The returned `NSString` object contains the string representations of each of the dictionary’s entries. [`description(withLocale:indent:)`](/documentation/Foundation/NSDictionary/description(withLocale:indent:)) obtains the string representation of a given key or value as follows:

- If the object is an `NSString` object, it is used as is.
- If the object responds to `descriptionWithLocale:indent:`, that method is invoked to obtain the object’s string representation.
- If the object responds to `descriptionWithLocale:`, that method is invoked to obtain the object’s string representation.
- If none of the above conditions is met, the object’s string representation is obtained by through its `description` property.

If each key in the dictionary responds to `compare:`, the entries are listed in ascending order, by key. Otherwise, the order in which the entries are listed is undefined.

---

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)