---
title: "attachmentBounds(for:location:textContainer:proposedLineFragment:position:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextattachmentviewprovider/attachmentbounds(for:location:textcontainer:proposedlinefragment:position:)"
---

# attachmentBounds(for:location:textContainer:proposedLineFragment:position:)

Returns the layout bounds for an attachment at a specific text location that contains the text attributes you specify.

## Declaration

```swift
func attachmentBounds(for attributes: [NSAttributedString.Key : Any], location: any NSTextLocation, textContainer: NSTextContainer?, proposedLineFragment: CGRect, position: CGPoint) -> CGRect
```

## Parameters

- `attributes`: A dictionary that contains a list of key and attribute pairs that describe the customization of the string.
- `location`: An doc://com.apple.appkit/documentation/AppKit/NSTextLocation that indicates that start of the string.
- `textContainer`: The doc://com.apple.appkit/documentation/AppKit/NSTextContainer that contains the source string.
- `proposedLineFragment`: A doc://com.apple.documentation/documentation/CoreFoundation/CGRect that describes the boundaries of the line fragment.
- `position`: A doc://com.apple.documentation/documentation/CoreFoundation/CGPoint inside proposedLineFragment.

## Return Value

Return Value Returns a CGRect that describes the bounds of the attachment.
