---
title: "usedRect(for:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/nslayoutmanager/usedrect(for:)"
---

# usedRect(for:)

Returns the bounding rectangle for the glyphs in the specified text container.

## Declaration

```swift
func usedRect(for container: NSTextContainer) -> CGRect
```

## Discussion

Discussion Returns the text container’s currently used area, which determines the size that the view would need to be in order to display all the glyphs that are currently laid out in the container. This causes neither glyph generation nor layout. Used rectangles are always in container coordinates.

## See Also

### Related Documentation

- [containerSize](appkit/nstextcontainer/containersize.md)

### Managing the text containers

- [textContainers](uikit/nslayoutmanager/textcontainers.md)
- [addTextContainer(_:)](uikit/nslayoutmanager/addtextcontainer(_:).md)
- [insertTextContainer(_:at:)](uikit/nslayoutmanager/inserttextcontainer(_:at:).md)
- [removeTextContainer(at:)](uikit/nslayoutmanager/removetextcontainer(at:).md)
- [setTextContainer(_:forGlyphRange:)](uikit/nslayoutmanager/settextcontainer(_:forglyphrange:).md)
- [textContainerChangedGeometry(_:)](uikit/nslayoutmanager/textcontainerchangedgeometry(_:).md)
- [textContainerChangedTextView(_:)](appkit/nslayoutmanager/textcontainerchangedtextview(_:).md)
- [textContainer(forGlyphAt:effectiveRange:)](uikit/nslayoutmanager/textcontainer(forglyphat:effectiverange:).md)
- [textContainer(forGlyphAt:effectiveRange:withoutAdditionalLayout:)](uikit/nslayoutmanager/textcontainer(forglyphat:effectiverange:withoutadditionallayout:).md)
