---
title: "enumerateContainerBoundaries(from:reverse:using:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/nstextselectiondatasource/enumeratecontainerboundaries(from:reverse:using:)"
---

# enumerateContainerBoundaries(from:reverse:using:)

Enumerates all the container boundaries starting from the location you specify.

## Declaration

```swift
optional func enumerateContainerBoundaries(from location: any NSTextLocation, reverse: Bool, using block: (any NSTextLocation, UnsafeMutablePointer<ObjCBool>) -> Void)
```

## Parameters

- `location`: The location where the enumeration starts.
- `reverse`: A Boolean value that indicates the enumeration starts at the end of the container.
- `block`: AA closure to invoke to evaluate the container boundaries; end the enumeration early by returning false.

## Discussion

Discussion This is an optional method you implement to enumerate the text up to the container or page boundary when the text selection data provider supports this layout functionality.

## See Also

### Enumerating components of the selection

- [enumerateCaretOffsetsInLineFragment(at:using:)](uikit/nstextselectiondatasource/enumeratecaretoffsetsinlinefragment(at:using:).md)
- [enumerateSubstrings(from:options:using:)](uikit/nstextselectiondatasource/enumeratesubstrings(from:options:using:).md)
