<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/DebugDescription()",
  "metadataVersion" : "0.1.0",
  "role" : "Macro",
  "symbol" : {
    "kind" : "Macro",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s16DebugDescriptionyycfm"
  },
  "title" : "DebugDescription()"
}
-->

# DebugDescription()

Converts description definitions to a debugger Type Summary.

```
@attached(member) @attached(memberAttribute) macro DebugDescription()
```

## Overview

This macro converts compatible description implementations written in Swift
to an LLDB format known as a Type Summary. A Type Summary is LLDB’s
equivalent to `debugDescription`, with the distinction that it does not
execute code inside the debugged process. By avoiding code execution,
descriptions can be produced faster, without potential side effects, and
shown in situations where code execution is not performed, such as the
variable list of an IDE.

Consider this an example. This `Team` struct has a `debugDescription` which
summarizes some key details, such as the team’s name. The debugger only
computes this string on demand - typically via the `po` command. By applying
the `DebugDescription` macro, a matching Type Summary is constructed. This
allows the user to show a string like “Rams [11-2]”, without executing
`debugDescription`. This improves the usability, performance, and
reliability of the debugging experience.

```
@DebugDescription
struct Team: CustomDebugStringConvertible {
   var name: String
   var wins, losses: Int

   var debugDescription: String {
       "\(name) [\(wins)-\(losses)]"
   }
}
```

The `DebugDescription` macro supports both `debugDescription`, `description`,
as well as a third option: a property named `lldbDescription`. The first
two are implemented when conforming to the `CustomDebugStringConvertible`
and `CustomStringConvertible` protocols. The additional `lldbDescription`
property is useful when both `debugDescription` and `description` are
implemented, but don’t meet the requirements of the `DebugDescription`
macro. If `lldbDescription` is implemented, `DebugDescription` choose it
over `debugDescription` and `description`. Likewise, `debugDescription` is
preferred over `description`.

### Description Requirements

The description implementation has the following requirements:

- The body of the description implementation must be a single string
  expression. String concatenation is not supported, use string interpolation
  instead.
- String interpolation can reference stored properties only, functions calls
  and other arbitrary computation are not supported. Of note, conditional
  logic and computed properties are not supported.
- Overloaded string interpolation cannot be used.

---

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)