---
title: "readSelection(from:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextview/readselection(from:)"
---

# readSelection(from:)

Reads the text view’s preferred type of data from the specified pasteboard.

## Declaration

```swift
func readSelection(from pboard: NSPasteboard) -> Bool
```

## Parameters

- `pboard`: The pasteboard to read from.

## Return Value

Return Value true if the data was successfully read, false otherwise.

## Discussion

Discussion This method invokes the preferredPasteboardType(from:restrictedToTypesFrom:) method to determine the text view’s preferred type of data and then reads the data using the readSelection(from:type:) method. You should not need to override this method. You might need to invoke this method if you are implementing a new type of pasteboard to handle services other than copy/paste or dragging.

## See Also

### Managing the pasteboard

- [preferredPasteboardType(from:restrictedToTypesFrom:)](appkit/nstextview/preferredpasteboardtype(from:restrictedtotypesfrom:).md)
- [readSelection(from:type:)](appkit/nstextview/readselection(from:type:).md)
- [readablePasteboardTypes](appkit/nstextview/readablepasteboardtypes.md)
- [writablePasteboardTypes](appkit/nstextview/writablepasteboardtypes.md)
- [writeSelection(to:type:)](appkit/nstextview/writeselection(to:type:).md)
- [writeSelection(to:types:)](appkit/nstextview/writeselection(to:types:).md)
- [validRequestor(forSendType:returnType:)](appkit/nstextview/validrequestor(forsendtype:returntype:).md)
