usedRect(for:)
Returns the bounding rectangle for the glyphs in the specified text container.
Declaration
func usedRect(for container: NSTextContainer) -> NSRectDiscussion
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.