---
title: "write(to:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsurl/write(to:)"
---

# write(to:)

Writes the URL to the specified pasteboard.

## Declaration

```swift
func write(to pasteBoard: NSPasteboard)
```

## Parameters

- `pasteBoard`: The target pasteboard.

## Discussion

Discussion You must declare an NSURLPboardType data type for the pasteboard before invoking this method. Otherwise, the method returns without doing anything.

## See Also

### Related Documentation

- [declareTypes(_:owner:)](appkit/nspasteboard/declaretypes(_:owner:).md)

### Working with Pasteboards

- [init(fromPasteboard:)](foundation/nsurl/init(frompasteboard:).md)
