---
title: "setInsertionHandler(_:)"
framework: cryptotokenkit
role: symbol
role_heading: Instance Method
path: "cryptotokenkit/tktokenwatcher/setinsertionhandler(_:)"
---

# setInsertionHandler(_:)

Sets an insertion handler closure to be called when a new token is inserted into the system.

## Declaration

```swift
func setInsertionHandler(_ insertionHandler: @escaping (String) -> Void)
```

## Parameters

- `insertionHandler`: A closure to be called whenever a token is added to the system. The closure takes a single argument, the tokenID, that identifies the added token.

## Mentioned in

Using Cryptographic Assets Stored on a Smart Card

## See Also

### Configuring Handlers

- [addRemovalHandler(_:forTokenID:)](cryptotokenkit/tktokenwatcher/addremovalhandler(_:fortokenid:).md)
