---
title: "setCurrentSelection(_:animate:)"
framework: pdfkit
role: symbol
role_heading: Instance Method
path: "pdfkit/pdfview/setcurrentselection(_:animate:)"
---

# setCurrentSelection(_:animate:)

Sets the current selection, in an animated way, if desired.

## Declaration

```swift
func setCurrentSelection(_ selection: PDFSelection?, animate: Bool)
```

## Discussion

Discussion This method behaves as setCurrentSelection(_:), but with the addition of animation, if animate is true. The animation serves to draw the user’s attention to the new selection, which can be useful when implementing search.

## See Also

### Handling Selections

- [currentSelection](pdfkit/pdfview/currentselection.md)
- [selectAll(_:)](pdfkit/pdfview/selectall(_:).md)
- [clearSelection()](pdfkit/pdfview/clearselection().md)
- [copy(_:)](pdfkit/pdfview/copy(_:).md)
- [scrollSelectionToVisible(_:)](pdfkit/pdfview/scrollselectiontovisible(_:).md)
- [highlightedSelections](pdfkit/pdfview/highlightedselections.md)
