---
title: "addTeardownBlock(_:)"
framework: xctest
role: symbol
role_heading: Instance Method
path: "xctest/xctestcase/addteardownblock(_:)-5zw6c"
---

# addTeardownBlock(_:)

Registers a block of teardown code to run after the current test method ends.

## Declaration

```swift
@preconcurrency func addTeardownBlock(_ block: @escaping @MainActor @Sendable () throws -> Void)
```

## Parameters

- `block`: A block of teardown code.

## See Also

### Customizing Test Setup and Teardown

- [Set Up and Tear Down State in Your Tests](xctest/set-up-and-tear-down-state-in-your-tests.md)
- [setUp()](xctest/xctestcase/setup().md)
- [addTeardownBlock(_:)](xctest/xctestcase/addteardownblock(_:)-2guon.md)
- [tearDown()](xctest/xctestcase/teardown().md)
