CreationKit Documentation

Protocol JTACMonth​View​Delegate

public protocol JTACMonthViewDelegate: AnyObject  
JTACMonthViewDelegate JTACMonthViewDelegate AnyObject AnyObject JTACMonthViewDelegate->AnyObject DatePicker DatePicker DatePicker->JTACMonthViewDelegate

Conforms To

AnyObject

Types Conforming to JTACMonth​View​Delegate

DatePicker

Date pickers let users select a date, or a range of dates. DatePickers are created with a configuration.

Default Implementations

calendar(_:​should​Select​Date:​cell:​cell​State:​index​Path:​)

func calendar(_ calendar: JTACMonthView, shouldSelectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) -> Bool  

calendar(_:​should​Deselect​Date:​cell:​cell​State:​index​Path:​)

func calendar(_ calendar: JTACMonthView, shouldDeselectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) -> Bool  

calendar(_:​did​Select​Date:​cell:​cell​State:​index​Path:​)

func calendar(_ calendar: JTACMonthView, didSelectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath)  

calendar(_:​did​Deselect​Date:​cell:​cell​State:​index​Path:​)

func calendar(_ calendar: JTACMonthView, didDeselectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath)  

calendar(_:​did​Highlight​Date:​cell:​cell​State:​index​Path:​)

func calendar(_ calendar: JTACMonthView, didHighlightDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath)  

calendar(_:​did​Unhighlight​Date:​cell:​cell​State:​index​Path:​)

func calendar(_ calendar: JTACMonthView, didUnhighlightDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath)  

calendar(_:​will​Scroll​ToDate​Segment​With:​)

func calendar(_ calendar: JTACMonthView, willScrollToDateSegmentWith visibleDates: DateSegmentInfo)  

calendar(_:​did​Scroll​ToDate​Segment​With:​)

func calendar(_ calendar: JTACMonthView, didScrollToDateSegmentWith visibleDates: DateSegmentInfo)  

calendar(_:​header​View​For​Date​Range:​at:​)

func calendar(_ calendar: JTACMonthView, headerViewForDateRange range: (start: Date, end: Date), at indexPath: IndexPath) -> JTACMonthReusableView  

calendar​Did​Scroll(_:​)

func calendarDidScroll(_ calendar: JTACMonthView)  

calendar​Size​For​Months(_:​)

func calendarSizeForMonths(_ calendar: JTACMonthView?) -> MonthSize?  

size​OfDecoration​View(index​Path:​)

func sizeOfDecorationView(indexPath: IndexPath) -> CGRect  

scroll​Did​End​Decelerating(for:​)

func scrollDidEndDecelerating(for calendar: JTACMonthView)  

Requirements

calendar(_:​should​Select​Date:​cell:​cell​State:​index​Path:​)

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

calendar JTACMonth​View

The JTAppleCalendar view requesting this information.

date Date

The date attached to the date-cell.

cell JTACDay​Cell?

The date-cell view. This can be customized at this point.

cell​State Cell​State

The month the date-cell belongs to.

Returns

A Bool value indicating if the operation can be done.

calendar(_:​should​Deselect​Date:​cell:​cell​State:​index​Path:​)

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

calendar JTACMonth​View

The JTAppleCalendar view requesting this information.

date Date

The date attached to the date-cell.

cell JTACDay​Cell?

The date-cell view. This can be customized at this point.

cell​State Cell​State

The month the date-cell belongs to.

Returns

A Bool value indicating if the operation can be done.

calendar(_:​did​Select​Date:​cell:​cell​State:​index​Path:​)

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

calendar JTACMonth​View

The JTAppleCalendar view giving this information.

date Date

The date attached to the date-cell.

cell JTACDay​Cell?

The date-cell view. This can be customized at this point. This may be nil if the selected cell is off the screen

cell​State Cell​State

The month the date-cell belongs to.

calendar(_:​did​Deselect​Date:​cell:​cell​State:​index​Path:​)

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

calendar JTACMonth​View

The JTAppleCalendar view giving this information.

date Date

The date attached to the date-cell.

cell JTACDay​Cell?

The date-cell view. This can be customized at this point. This may be nil if the selected cell is off the screen

cell​State Cell​State

The month the date-cell belongs to.

calendar(_:​did​Highlight​Date:​cell:​cell​State:​index​Path:​)

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

calendar JTACMonth​View

The JTAppleCalendar view giving this information.

date Date

The date attached to the date-cell.

cell​State Cell​State

The month the date-cell belongs to.

calendar(_:​did​Unhighlight​Date:​cell:​cell​State:​index​Path:​)

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

calendar JTACMonth​View

The JTAppleCalendar view giving this information.

date Date

The date attached to the date-cell.

cell​State Cell​State

The month the date-cell belongs to.

calendar(_:​did​Scroll​ToDate​Segment​With:​)

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

calendar JTACMonth​View

The JTAppleCalendar view giving this information.

start​Date

The date at the start of the segment.

end​Date

The date at the end of the segment.

calendar(_:​will​Scroll​ToDate​Segment​With:​)

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

calendar JTACMonth​View

The JTAppleCalendar view giving this information.

start​Date

The date at the start of the segment.

end​Date

The date at the end of the segment.

calendar(_:​cell​For​Item​At:​cell​State:​index​Path:​)

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

calendar JTACMonth​View

The JTAppleCalendar view giving this information.

date Date

The date attached to the cell.

cell​State Cell​State

The month the date-cell belongs to.

index​Path Index​Path

use this value when dequeing cells

calendar(_:​header​View​For​Date​Range:​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

calendar JTACMonth​View

The JTAppleCalendar view giving this information.

date

The date attached to the header.

index​Path Index​Path

use this value when dequeing cells

scroll​Did​End​Decelerating(for:​)

func scrollDidEndDecelerating(for calendar: JTACMonthView) 

Informs the delegate that the user just lifted their finger from swiping the calendar

calendar​Did​Scroll(_:​)

func calendarDidScroll(_ calendar: JTACMonthView) 

Tells the delegate that a scroll occurred

calendar​Size​For​Months(_:​)

func calendarSizeForMonths(_ calendar: JTACMonthView?) -> MonthSize? 

Called to retrieve the size to be used for the month headers

calendar(_:​will​Display:​for​Item​At:​cell​State:​index​Path:​)

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

calendar JTACMonth​View

The JTAppleCalendar view giving this information.

cell JTACDay​Cell

The cell

date Date

date attached to the cell

cell​State Cell​State

The month the date-cell belongs to.

index​Path Index​Path

use this value when dequeing cells

size​OfDecoration​View(index​Path:​)

func sizeOfDecorationView(indexPath: IndexPath) -> CGRect

Called to retrieve the size to be used for decoration views