---
title: "init(string:)"
framework: xctest
role: symbol
role_heading: Initializer
path: "xctest/xctattachment/init(string:)"
---

# init(string:)

Creates an attachment containing the provided string.

## Declaration

```swift
convenience init(string: String)
```

## Parameters

- `string`: The string to wrap as an attachment.

## Discussion

Discussion Creates an attachment with a uniformTypeIdentifier of "``public.plain-text".
