---
title: UICalendarSelectionWeekOfYear
framework: uikit
role: symbol
role_heading: Class
path: uikit/uicalendarselectionweekofyear
---

# UICalendarSelectionWeekOfYear

An object that tracks a specific week a person selects from a calendar view.

## Declaration

```swift
@MainActor class UICalendarSelectionWeekOfYear
```

## Overview

Overview Use the UICalendarSelectionWeekOfYear selection behavior to allow selecting dates in a calendar view by week. The following code example shows how to configure a calendar view’s selection behavior to use week-of-year selection: // Create a calendar view. let calendarView = UICalendarView() calendarView.calendar = Calendar(identifier: .gregorian)

// Set the selection behavior. let selection = UICalendarSelectionWeekOfYear(delegate: self) calendarView.selectionBehavior = selection

// Set the 11th week in the year 2024. selection.selectedWeekOfYear = DateComponents(     calendar: Calendar(identifier: .gregorian),     weekOfYear: 11,     yearForWeekOfYear: 2024)

## Topics

### Creating a week-of-year selection

- [init(delegate:)](uikit/uicalendarselectionweekofyear/init(delegate:).md)

### Setting the selection delegate

- [delegate](uikit/uicalendarselectionweekofyear/delegate.md)
- [UICalendarSelectionWeekOfYearDelegate](uikit/uicalendarselectionweekofyeardelegate.md)

### Updating the selected week

- [selectedWeekOfYear](uikit/uicalendarselectionweekofyear/selectedweekofyear.md)
- [setSelected(_:animated:)](uikit/uicalendarselectionweekofyear/setselected(_:animated:).md)

## Relationships

### Inherits From

- [UICalendarSelection](uikit/uicalendarselection.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Handling date selections

- [selectionBehavior](uikit/uicalendarview/selectionbehavior.md)
- [UICalendarSelectionSingleDate](uikit/uicalendarselectionsingledate.md)
- [UICalendarSelectionMultiDate](uikit/uicalendarselectionmultidate.md)
- [UICalendarSelection](uikit/uicalendarselection.md)
