---
title: "setSelected(_:animated:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uicalendarselectionsingledate/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.

## Declaration

```swift
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.

## See Also

### Updating the selected date

- [selectedDate](uikit/uicalendarselectionsingledate/selecteddate.md)
