---
title: "tokens(in:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uisearchtextfield/tokens(in:)"
---

# tokens(in:)

Returns the search field’s tokens that are within a given range.

## Declaration

```swift
func tokens(in textRange: UITextRange) -> [UISearchToken]
```

## Parameters

- `textRange`: The range specifying a subset of the tokens.

## Return Value

Return Value The tokens contained within the provided range.

## Discussion

Discussion Use this method to find out which tokens are included in the user’s current selection. You can provide a range that spans a mixture of tokens and text.

## See Also

### Customizing token behavior

- [tokenBackgroundColor](uikit/uisearchtextfield/tokenbackgroundcolor.md)
- [positionOfToken(at:)](uikit/uisearchtextfield/positionoftoken(at:).md)
