<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIManagedDocument/writeAdditionalContent(_:to:originalContentsURL:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIManagedDocument(im)writeAdditionalContent:toURL:originalContentsURL:error:"
  },
  "title" : "writeAdditionalContent(_:to:originalContentsURL:)"
}
-->

# writeAdditionalContent(_:to:originalContentsURL:)

Handles writing non-Core Data content to the document’s file package.

```
func writeAdditionalContent(_ content: Any, to absoluteURL: URL, originalContentsURL absoluteOriginalContentsURL: URL?) throws
```

## Parameters

`content`

An object that represents the additional content for the document.

    This is the object returned from [`additionalContent(for:)`](/documentation/UIKit/UIManagedDocument/additionalContent(for:))    .

`absoluteURL`

The URL to which to write the additional content.

`absoluteOriginalContentsURL`

The current URL of the document that’s being saved.

## Discussion

You override this method to perform to write non-Core Data content in the additional content directory in the document’s file package. There are several issues to consider:

- You should typically implement this method only if you also implemented [`additionalContent(for:)`](/documentation/UIKit/UIManagedDocument/additionalContent(for:)).
- Because this method is executed asynchronously, it’s possible that the document’s state may be different from that at which the save operation was initiated. If you need to capture the document state at save time, you should do so in [`additionalContent(for:)`](/documentation/UIKit/UIManagedDocument/additionalContent(for:)).
- If you implement this method, it’s invoked automatically by [`writeContents(_:andAttributes:safelyTo:for:)`](/documentation/UIKit/UIDocument/writeContents(_:andAttributes:safelyTo:for:)).
- There’s no need to invoke `super`’s implementation.

> Handling Errors in Swift:
> In Swift, this method is marked with the `throws` keyword to indicate that it throws an error in cases of failure.
> 
> When overriding this method, use the `throw` statement to throw an `NSError`, as described in [Error Handling](https://docs.swift.org/swift-book/LanguageGuide/ErrorHandling.html) in [The Swift Programming Language](https://docs.swift.org/swift-book/) and `About Imported Cocoa Error Parameters`.

### Special considerations

Additional content isn’t supported on iCloud.

---

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)