<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UICalendarView/setVisibleDateComponents(_:animated:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UICalendarView(im)setVisibleDateComponents:animated:"
  },
  "title" : "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.

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

The date that `dateComponents` represents must be within the dates that [`availableDateRange`](/documentation/UIKit/UICalendarView/availableDateRange) represents.

If `dateComponents.calendar` is `nil` or isn’t equal to [`calendar`](/documentation/UIKit/UICalendarView/calendar), the calendar view uses [`calendar`](/documentation/UIKit/UICalendarView/calendar), which may result in an invalid date from the date components.

---

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)