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

# write(to:)

Writes the string into the given output stream.

## Declaration

```swift
func write<Target>(to target: inout Target) where Target : TextOutputStream
```

## Parameters

- `target`: An output stream.

## See Also

### Writing to a File or URL

- [write(_:)](swift/string/write(_:).md)
