---
title: "addRemovalHandler(_:forTokenID:)"
framework: cryptotokenkit
role: symbol
role_heading: Instance Method
path: "cryptotokenkit/tktokenwatcher/addremovalhandler(_:fortokenid:)"
---

# addRemovalHandler(_:forTokenID:)

Adds a removal handler for the specified token ID.

## Declaration

```swift
func addRemovalHandler(_ removalHandler: @escaping (String) -> Void, forTokenID tokenID: String)
```

## Parameters

- `removalHandler`: A block to be called when the specified token is removed. This block takes a single argument:
- `tokenID`: The identifier of the token to watch for removal. If doc://com.apple.cryptotokenkit/documentation/CryptoTokenKit/TKTokenWatcher/tokenIDs doesn’t contain tokenID, insertionHandler is executed immediately.

## Mentioned in

Using Cryptographic Assets Stored on a Smart Card

## Discussion

Discussion You typically call this method in the insertionHandler passed to the token watcher initializer. Adding a removal handler will remove any existing removal handlers for the specified token ID.

## See Also

### Configuring Handlers

- [setInsertionHandler(_:)](cryptotokenkit/tktokenwatcher/setinsertionhandler(_:).md)
