---
title: "setString(_:forType:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nspasteboarditem/setstring(_:fortype:)"
---

# setString(_:forType:)

Sets the value for a specified type as a string.

## Declaration

```swift
func setString(_ string: String, forType type: NSPasteboard.PasteboardType) -> Bool
```

## Parameters

- `string`: A string for the representation specified by type.
- `type`: A uniform type identifier string.

## Return Value

Return Value true if the value was set successfully, otherwise false.

## See Also

### Setting values

- [setData(_:forType:)](appkit/nspasteboarditem/setdata(_:fortype:).md)
- [setPropertyList(_:forType:)](appkit/nspasteboarditem/setpropertylist(_:fortype:).md)
