<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSAttributedString/CompletionHandler",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@T@NSAttributedStringCompletionHandler"
  },
  "title" : "NSAttributedString.CompletionHandler"
}
-->

# NSAttributedString.CompletionHandler

A completion handler for getting an asynchronous attributed string.

```
typealias CompletionHandler = (NSAttributedString?, [NSAttributedString.DocumentAttributeKey : Any]?, (any Error)?) -> Void
```

## Parameters

`attributedString`

The attributed string, or nil if the method couldn’t create the string.

`attributes`

A dictionary containing document-level attributes. This parameter is `nil` if the document doesn’t have any attributes.

`error`

An error object if an error occurred, or `nil` if the method returned the string successfully.

---

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)