---
title: "setVisibleDateComponents(_:animated:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uicalendarview/setvisibledatecomponents(_:animated:)"
---

# setVisibleDateComponents(_:animated:)

Sets the date components that represent the date for the calendar view to make visible, with an option to animate the date change.

## Declaration

```swift
func setVisibleDateComponents(_ dateComponents: DateComponents, animated: Bool)
```

## Parameters

- `dateComponents`: Date components that represent the date for the calendar view to display.
- `animated`: A Boolean value that indicates whether the calendar view animates the date change.

## Discussion

Discussion The date that dateComponents represents must be within the dates that availableDateRange represents. If dateComponents.calendar is nil or isn’t equal to calendar, the calendar view uses calendar, which may result in an invalid date from the date components.

## See Also

### Setting the visible date and range

- [visibleDateComponents](uikit/uicalendarview/visibledatecomponents.md)
- [availableDateRange](uikit/uicalendarview/availabledaterange.md)
