<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PDFKit",
  "identifier" : "/documentation/PDFKit/PDFView/setCurrentSelection(_:animate:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "PDFKit"
    ],
    "preciseIdentifier" : "c:objc(cs)PDFView(im)setCurrentSelection:animate:"
  },
  "title" : "setCurrentSelection(_:animate:)"
}
-->

# setCurrentSelection(_:animate:)

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

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

## Discussion

This method behaves as `setCurrentSelection(_:)`, but with the addition of animation, if `animate` is <doc://com.apple.documentation/documentation/Swift/true>. The animation serves to draw the user’s attention to the new selection, which can be useful when implementing search.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)