<!--
{
  "availability" : [
    "macOS: 12.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextSelectionDataSource/enumerateContainerBoundaries(from:reverse:using:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTextSelectionDataSource(im)enumerateContainerBoundariesFromLocation:reverse:usingBlock:"
  },
  "title" : "enumerateContainerBoundaries(from:reverse:using:)"
}
-->

# enumerateContainerBoundaries(from:reverse:using:)

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

```
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`

A closure to invoke to evaluate the container boundaries; end the enumeration early by returning `false`.

## 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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)