<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UICalendarSelectionSingleDate/setSelected(_:animated:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UICalendarSelectionSingleDate(im)setSelectedDate:animated:"
  },
  "title" : "setSelected(_:animated:)"
}
-->

# setSelected(_:animated:)

Updates the date component object that represents a selected date in a calendar view, with an option to animate the change.

```
func setSelected(_ selectedDate: DateComponents?, animated: Bool)
```

## Parameters

`selectedDate`

A date component object that represents a date to select in a calendar view.

`animated`

A Boolean value that indicates whether the calendar view should animate changing the selected date.

---

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)