<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSAttributedString/containsAttachments(in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSAttributedString(im)containsAttachmentsInRange:"
  },
  "title" : "containsAttachments(in:)"
}
-->

# containsAttachments(in:)

Returns a Boolean value that indicates if the attributed string contains an attachment in the specified range.

```
func containsAttachments(in range: NSRange) -> Bool
```

## Parameters

`range`

The range.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the attributed string contains a property configured as [`attachment`](/documentation/Foundation/NSAttributedString/Key/attachment) with <doc://com.apple.documentation/documentation/AppKit/NSTextAttachment/character> in `range`; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

---

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)