<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "XCTest",
  "identifier" : "/documentation/XCTest/XCTIssueReference",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "XCTest"
    ],
    "preciseIdentifier" : "c:objc(cs)XCTIssue"
  },
  "title" : "XCTIssueReference"
}
-->

# XCTIssueReference

An object that represents a test failure, and includes source code call stacks for test reporting and investigation.

```
class XCTIssueReference
```

## Overview

In Swift, `XCTIssueReference` bridges to the Objective-C class `XCTIssue`. When you need reference semantics in your Swift test handling, use `XCTIssueReference`; otherwise, use the Swift value semantic [`XCTIssue`](/documentation/XCTest/XCTIssue-swift.struct). In Objective-C, `XCTIssue` supports bridging to Swift with `XCTIssueReference`.

## Topics

### Initializers

[`convenience init(type: XCTIssueReference.IssueType, compactDescription: String)`](/documentation/XCTest/XCTIssueReference/init(type:compactDescription:))

Creates an issue with a compact description for a test failure.

[`init(type: XCTIssueReference.IssueType, compactDescription: String, detailedDescription: String?, sourceCodeContext: XCTSourceCodeContext, associatedError: (any Error)?, attachments: [XCTAttachment])`](/documentation/XCTest/XCTIssueReference/init(type:compactDescription:detailedDescription:sourceCodeContext:associatedError:attachments:))

Creates an issue for a test failure, with descriptions, source code location, error, and attachments.

### Issue Types

[`enum IssueType`](/documentation/XCTest/XCTIssueReference/IssueType)

Constants that indicate types of test failures, such as assertion failures, performance regressions, or thrown errors.

### Issue Details

[`var type: XCTIssueReference.IssueType`](/documentation/XCTest/XCTIssueReference/type)

A value for classifying an issue that occurs during testing.

[`var compactDescription: String`](/documentation/XCTest/XCTIssueReference/compactDescription)

A concise description of the issue with no transient data, suitable for use in test run summaries and results aggregation across multiple test runs.

[`var detailedDescription: String?`](/documentation/XCTest/XCTIssueReference/detailedDescription)

A detailed description of the issue that may include transient data, such as numbers, object identifiers, and timestamps, to help diagnose the issue.

[`var sourceCodeContext: XCTSourceCodeContext`](/documentation/XCTest/XCTIssueReference/sourceCodeContext)

The source code location for the issue, including the filename, line number, and call stack.

[`var associatedError: (any Error)?`](/documentation/XCTest/XCTIssueReference/associatedError)

An optional error to associate with a test issue.

[`var attachments: [XCTAttachment]`](/documentation/XCTest/XCTIssueReference/attachments)

An array of data that augments a test issue, such as files, images, screenshots, data blobs, or ZIP files.

### Initializers

[`init(type: XCTIssueReference.IssueType, compactDescription: String, detailedDescription: String?, sourceCodeContext: XCTSourceCodeContext, associatedError: (any Error)?, attachments: [XCTAttachment], severity: XCTIssueReference.Severity)`](/documentation/XCTest/XCTIssueReference/init(type:compactDescription:detailedDescription:sourceCodeContext:associatedError:attachments:severity:))

[`convenience init(type: XCTIssueReference.IssueType, compactDescription: String, severity: XCTIssueReference.Severity)`](/documentation/XCTest/XCTIssueReference/init(type:compactDescription:severity:))

### Instance Properties

[`var isFailure: Bool`](/documentation/XCTest/XCTIssueReference/isFailure)

Whether or not this issue should cause the test it’s associated with to be
considered a failure.

[`var severity: XCTIssueReference.Severity`](/documentation/XCTest/XCTIssueReference/severity-swift.property)

The severity of the issue.

### Enumerations

[`enum Severity`](/documentation/XCTest/XCTIssueReference/Severity-swift.enum)

An enum representing the severity of a test issue.

## Relationships

### Conforms To

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`NSMutableCopying`](/documentation/Foundation/NSMutableCopying)

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

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

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

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

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`NSCoding`](/documentation/Foundation/NSCoding)

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

[`NSCopying`](/documentation/Foundation/NSCopying)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

### Inherited By

[`XCTMutableIssue`](/documentation/XCTest/XCTMutableIssue)

---

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)