---
title: "writePlaceholder(at:withMetadata:)"
framework: fileprovider
role: symbol
role_heading: Type Method
path: "fileprovider/nsfileproviderextension/writeplaceholder(at:withmetadata:)"
---

# writePlaceholder(at:withMetadata:)

Writes a document placeholder with the provided metadata.

## Declaration

```swift
class func writePlaceholder(at placeholderURL: URL, withMetadata metadata: [URLResourceKey : Any]) throws
```

## Parameters

- `placeholderURL`: The placeholder URL for the document. You can generate a placeholder URL from a document URL by calling doc://com.apple.fileprovider/documentation/FileProvider/NSFileProviderExtension/placeholderURL(for:).
- `metadata`: The metadata for this document.

## Discussion

Discussion Call this method whenever you need to create a placeholder for a document. The metadata that you provide depends largely on the needs of your document picker’s user interface; however, the common options include file size, filename, and thumbnails. You must not override this method. note: In Swift, this method returns a nonoptional result and is marked with the throws keyword to indicate that it throws an error in cases of failure. You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in Error Handling in The Swift Programming Language and About Imported Cocoa Error Parameters.

## See Also

### Managing placeholders

- [placeholderURL(for:)](fileprovider/nsfileproviderextension/placeholderurl(for:).md)
