Protocol
JTACMonthViewDelegate
public protocol JTACMonthViewDelegate: AnyObject
Relationships
Conforms To
AnyObject
Types Conforming to JTACMonthViewDelegate
DatePicker
Date pickers let users select a date, or a range of dates. DatePickers are created with a configuration.
Default Implementations
calendar(_:shouldSelectDate:cell:cellState:indexPath:)
func calendar(_ calendar: JTACMonthView, shouldSelectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) -> Bool
calendar(_:shouldDeselectDate:cell:cellState:indexPath:)
func calendar(_ calendar: JTACMonthView, shouldDeselectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) -> Bool
calendar(_:didSelectDate:cell:cellState:indexPath:)
func calendar(_ calendar: JTACMonthView, didSelectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath)
calendar(_:didDeselectDate:cell:cellState:indexPath:)
func calendar(_ calendar: JTACMonthView, didDeselectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath)
calendar(_:didHighlightDate:cell:cellState:indexPath:)
func calendar(_ calendar: JTACMonthView, didHighlightDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath)
calendar(_:didUnhighlightDate:cell:cellState:indexPath:)
func calendar(_ calendar: JTACMonthView, didUnhighlightDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath)
calendar(_:willScrollToDateSegmentWith:)
func calendar(_ calendar: JTACMonthView, willScrollToDateSegmentWith visibleDates: DateSegmentInfo)
calendar(_:didScrollToDateSegmentWith:)
func calendar(_ calendar: JTACMonthView, didScrollToDateSegmentWith visibleDates: DateSegmentInfo)
calendar(_:headerViewForDateRange:at:)
func calendar(_ calendar: JTACMonthView, headerViewForDateRange range: (start: Date, end: Date), at indexPath: IndexPath) -> JTACMonthReusableView
calendarDidScroll(_:)
func calendarDidScroll(_ calendar: JTACMonthView)
calendarSizeForMonths(_:)
func calendarSizeForMonths(_ calendar: JTACMonthView?) -> MonthSize?
sizeOfDecorationView(indexPath:)
func sizeOfDecorationView(indexPath: IndexPath) -> CGRect
scrollDidEndDecelerating(for:)
func scrollDidEndDecelerating(for calendar: JTACMonthView)
Requirements
calendar(_:shouldSelectDate:cell:cellState:indexPath:)
func calendar(_ calendar: JTACMonthView, shouldSelectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) -> Bool
Asks the delegate if selecting the date-cell with a specified date is allowed
Parameters
Name | Type | Description |
---|---|---|
calendar | JTACMonthView |
The JTAppleCalendar view requesting this information. |
date | Date |
The date attached to the date-cell. |
cell | JTACDayCell? |
The date-cell view. This can be customized at this point. |
cellState | CellState |
The month the date-cell belongs to. |
Returns
A Bool value indicating if the operation can be done.
calendar(_:shouldDeselectDate:cell:cellState:indexPath:)
func calendar(_ calendar: JTACMonthView, shouldDeselectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) -> Bool
Asks the delegate if de-selecting the date-cell with a specified date is allowed
Parameters
Name | Type | Description |
---|---|---|
calendar | JTACMonthView |
The JTAppleCalendar view requesting this information. |
date | Date |
The date attached to the date-cell. |
cell | JTACDayCell? |
The date-cell view. This can be customized at this point. |
cellState | CellState |
The month the date-cell belongs to. |
Returns
A Bool value indicating if the operation can be done.
calendar(_:didSelectDate:cell:cellState:indexPath:)
func calendar(_ calendar: JTACMonthView, didSelectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath)
Tells the delegate that a date-cell with a specified date was selected
Parameters
Name | Type | Description |
---|---|---|
calendar | JTACMonthView |
The JTAppleCalendar view giving this information. |
date | Date |
The date attached to the date-cell. |
cell | JTACDayCell? |
The date-cell view. This can be customized at this point. This may be nil if the selected cell is off the screen |
cellState | CellState |
The month the date-cell belongs to. |
calendar(_:didDeselectDate:cell:cellState:indexPath:)
func calendar(_ calendar: JTACMonthView, didDeselectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath)
Tells the delegate that a date-cell with a specified date was de-selected
Parameters
Name | Type | Description |
---|---|---|
calendar | JTACMonthView |
The JTAppleCalendar view giving this information. |
date | Date |
The date attached to the date-cell. |
cell | JTACDayCell? |
The date-cell view. This can be customized at this point. This may be nil if the selected cell is off the screen |
cellState | CellState |
The month the date-cell belongs to. |
calendar(_:didHighlightDate:cell:cellState:indexPath:)
func calendar(_ calendar: JTACMonthView, didHighlightDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath)
Tells the delegate that the item at the specified index path was highlighted.
Parameters
Name | Type | Description |
---|---|---|
calendar | JTACMonthView |
The JTAppleCalendar view giving this information. |
date | Date |
The date attached to the date-cell. |
cellState | CellState |
The month the date-cell belongs to. |
calendar(_:didUnhighlightDate:cell:cellState:indexPath:)
func calendar(_ calendar: JTACMonthView, didUnhighlightDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath)
Tells the delegate that the item at the specified index path was un-highlighted.
Parameters
Name | Type | Description |
---|---|---|
calendar | JTACMonthView |
The JTAppleCalendar view giving this information. |
date | Date |
The date attached to the date-cell. |
cellState | CellState |
The month the date-cell belongs to. |
calendar(_:didScrollToDateSegmentWith:)
func calendar(_ calendar: JTACMonthView, didScrollToDateSegmentWith visibleDates: DateSegmentInfo)
Tells the delegate that the JTAppleCalendar view scrolled to a segment beginning and ending with a particular date
Parameters
Name | Type | Description |
---|---|---|
calendar | JTACMonthView |
The JTAppleCalendar view giving this information. |
startDate | The date at the start of the segment. |
|
endDate | The date at the end of the segment. |
calendar(_:willScrollToDateSegmentWith:)
func calendar(_ calendar: JTACMonthView, willScrollToDateSegmentWith visibleDates: DateSegmentInfo)
Tells the delegate that the JTAppleCalendar view will scroll to a segment beginning and ending with a particular date
Parameters
Name | Type | Description |
---|---|---|
calendar | JTACMonthView |
The JTAppleCalendar view giving this information. |
startDate | The date at the start of the segment. |
|
endDate | The date at the end of the segment. |
calendar(_:cellForItemAt:cellState:indexPath:)
func calendar(_ calendar: JTACMonthView, cellForItemAt date: Date, cellState: CellState, indexPath: IndexPath) -> JTACDayCell
Tells the delegate that the JTAppleCalendar is about to display a date-cell. This is the point of customization for your date cells
Parameters
Name | Type | Description |
---|---|---|
calendar | JTACMonthView |
The JTAppleCalendar view giving this information. |
date | Date |
The date attached to the cell. |
cellState | CellState |
The month the date-cell belongs to. |
indexPath | IndexPath |
use this value when dequeing cells |
calendar(_:headerViewForDateRange:at:)
func calendar(_ calendar: JTACMonthView, headerViewForDateRange range: (start: Date, end: Date), at indexPath: IndexPath) -> JTACMonthReusableView
Tells the delegate that the JTAppleCalendar is about to display a header. This is the point of customization for your headers
Parameters
Name | Type | Description |
---|---|---|
calendar | JTACMonthView |
The JTAppleCalendar view giving this information. |
date | The date attached to the header. |
|
indexPath | IndexPath |
use this value when dequeing cells |
scrollDidEndDecelerating(for:)
func scrollDidEndDecelerating(for calendar: JTACMonthView)
Informs the delegate that the user just lifted their finger from swiping the calendar
calendarDidScroll(_:)
func calendarDidScroll(_ calendar: JTACMonthView)
Tells the delegate that a scroll occurred
calendarSizeForMonths(_:)
func calendarSizeForMonths(_ calendar: JTACMonthView?) -> MonthSize?
Called to retrieve the size to be used for the month headers
calendar(_:willDisplay:forItemAt:cellState:indexPath:)
func calendar(_ calendar: JTACMonthView, willDisplay cell: JTACDayCell, forItemAt date: Date, cellState: CellState, indexPath: IndexPath)
Implement the function to configure calendar cells. The code that will go in here is the same that you will code for your cellForItem function. This function is only called to address inconsistencies in the visual appearance as stated by Apple: https://developer.apple.com/documentation/uikit/uicollectionview/1771771-prefetchingenabled a date-cell. This is the point of customization for your date cells
Parameters
Name | Type | Description |
---|---|---|
calendar | JTACMonthView |
The JTAppleCalendar view giving this information. |
cell | JTACDayCell |
The cell |
date | Date |
date attached to the cell |
cellState | CellState |
The month the date-cell belongs to. |
indexPath | IndexPath |
use this value when dequeing cells |
sizeOfDecorationView(indexPath:)
func sizeOfDecorationView(indexPath: IndexPath) -> CGRect
Called to retrieve the size to be used for decoration views