<!--
{
  "availability" : [
    "DriverKit: -",
    "iOS: -",
    "iPadOS: -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "DriverKit",
  "identifier" : "/documentation/DriverKit/IOReporter/createLegend",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "DriverKit"
    ],
    "preciseIdentifier" : "c:@S@IOReporter@F@createLegend#"
  },
  "title" : "createLegend"
}
-->

# createLegend

Create a legend entry represending this reporter’s channels.

```
OSDictionary * createLegend();
```

## Return Value

An [`IOReportLegendEntry`](/documentation/DriverKit/IOReportLegendEntry) object or `NULL` on failure.

## Discussion

All channels added to the reporter will be represented
in the resulting legend entry.

Legends must be published together as an array under the
`kIOReportLegendKey` in the I/O Kit registry.  The [`IOReportLegend`](/documentation/DriverKit/IOReportLegend)
class can be used to properly combine legend entries from multiple
reporters as well as to put channels into groups of interest to
observers.  When published, individual legend entries share
characteristics such as group and sub-group.  Multiple [`IOReporter`](/documentation/DriverKit/IOReporter)
instances are required to produce independent legend entries which
can then be published with different characteristics.

Drivers wishing to publish legends should do so as part of their
`::start()` routine.  As superclasses *may* have installed legend
entries, any existing existing legend should be retrieved and
IOReportLegend used to merge it with the new entries.

Recommendations for best practices are forthcoming.

Instead of calling createLegend on your reporter object and then
appending it manually to IOReportLegend, one may prefer to call
[`addReporterLegend`](/documentation/DriverKit/IOReportLegend/addReporterLegend-c.method) which creates and appends a
reporter’s [`IOReportLegendEntry`](/documentation/DriverKit/IOReportLegendEntry) in a single call.

Locking: same-instance concurrency SAFE, MAY BLOCK

---

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)