<!--
{
  "availability" : [
    "Swift: 6.2.0 -",
    "Xcode: 26.0.0 -",
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "swift: 6.0.0 -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Testing",
  "identifier" : "/documentation/Testing/IssueHandlingTrait",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Swift Testing"
    ],
    "preciseIdentifier" : "s:7Testing18IssueHandlingTraitV"
  },
  "title" : "IssueHandlingTrait"
}
-->

# IssueHandlingTrait

A type that allows transforming or filtering the issues recorded by a test.

```
struct IssueHandlingTrait
```

## Overview

Use this type to observe or customize the issue(s) recorded by the test this
trait is applied to. You can transform a recorded issue by copying it,
modifying one or more of its properties, and returning the copy. You can
observe recorded issues by returning them unmodified. Or you can suppress an
issue by either filtering it using [`filterIssues(_:)`](/documentation/Testing/Trait/filterIssues(_:)) or returning
`nil` from the closure passed to [`compactMapIssues(_:)`](/documentation/Testing/Trait/compactMapIssues(_:)).

When an instance of this trait is applied to a suite, it is recursively
inherited by all child suites and tests.

To add this trait to a test, use one of the following functions:

- [`compactMapIssues(_:)`](/documentation/Testing/Trait/compactMapIssues(_:))
- [`filterIssues(_:)`](/documentation/Testing/Trait/filterIssues(_:))

## Topics

### Instance Methods

[`func handleIssue(Issue) -> Issue?`](/documentation/Testing/IssueHandlingTrait/handleIssue(_:))

Handle a specified issue.

## Relationships

### Conforms To

[`Trait`](/documentation/Testing/Trait)

[`TestScoping`](/documentation/Testing/TestScoping)

[`Sendable`](/documentation/Swift/Sendable)

[`Copyable`](/documentation/Swift/Copyable)

[`SuiteTrait`](/documentation/Testing/SuiteTrait)

[`Escapable`](/documentation/Swift/Escapable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`TestTrait`](/documentation/Testing/TestTrait)

---

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)