GCCalendarViewDelegate
public protocol GCCalendarViewDelegate: class
The delegate of a GCCalendarView object must adopt the GCCalendarViewDelegate protocol. The protocol’s optional methods allow the delegate to handle date selection and customize the calendar view’s appearance.
-
Tells the delegate that the calendar view selected a new date in the specified calendar.
Declaration
Swift
func calendarView(_ calendarView: GCCalendarView, didSelectDate date: Date, inCalendar calendar: Calendar)
Parameters
calendarView
The calendar view.
date
The selected date.
calendar
The calendar used to configure the calendar view.
-
calendar(calendarView:)
Default implementationAsks the delegate to provide the calendar for the calendar view.
Default Value
Calendar.current
Default Implementation
Declaration
Swift
func calendar(calendarView: GCCalendarView) -> Calendar
Parameters
calendarView
The calendar view requesting this information.
Return Value
The calendar for the calendar view.
-
weekdayLabelFont(calendarView:)
Default implementationAsks the delegate to provide the font for the calendar view’s weekday labels.
Default Value
UIFont.systemFont(ofSize: 10)
Default Implementation
Declaration
Swift
func weekdayLabelFont(calendarView: GCCalendarView) -> UIFont
Parameters
calendarView
The calendar view requesting this information.
Return Value
The font for the weekday labels.
-
weekdayLabelTextColor(calendarView:)
Default implementationAsks the delegate to provide the text color for the calendar view’s weekday labels.
Default Value
UIColor.gray
Default Implementation
Declaration
Swift
func weekdayLabelTextColor(calendarView: GCCalendarView) -> UIColor
Parameters
calendarView
The calendar view requesting this information.
Return Value
The text color for the weekday labels.
-
pastDatesEnabled(calendarView:)
Default implementationAsks the delegate if the calendar view should enable past dates.
The default value is true. If returning false, the calendar view will make past dates unselectable and will only display past dates for the current week or month, depending on the calendar display mode.
Default Implementation
Declaration
Swift
func pastDatesEnabled(calendarView: GCCalendarView) -> Bool
Parameters
calendarView
The calendar view requesting this information.
Return Value
A Boolean value inidicating whether or not the calendar view should enable past dates.
-
pastDateFont(calendarView:)
Default implementationAsks the delegate to provide the unselected font for past dates.
Default Value
UIFont.systemFont(ofSize: 17)
Default Implementation
Declaration
Swift
func pastDateFont(calendarView: GCCalendarView) -> UIFont
Parameters
calendarView
The calendar view requesting this information.
Return Value
The unselected font for past dates.
-
pastDateEnabledTextColor(calendarView:)
Default implementationAsks the delegate to provide the enabled text color for past dates.
Default Value
UIColor(white: 0.0, alpha: 0.87)
Default Implementation
Declaration
Swift
func pastDateEnabledTextColor(calendarView: GCCalendarView) -> UIColor
Parameters
calendarView
The calendar view requesting this information.
Return Value
The enabled text color for past dates.
-
pastDateDisabledTextColor(calendarView:)
Default implementationAsks the delegate to provide the disabled text color for past dates.
Default Value
UIColor.gray
Default Implementation
Declaration
Swift
func pastDateDisabledTextColor(calendarView: GCCalendarView) -> UIColor
Parameters
calendarView
The calendar view requesting this information.
Return Value
The disabled text color for past dates.
-
pastDateSelectedFont(calendarView:)
Default implementationAsks the delegate to provide the selected font for past dates.
Default Value
UIFont.boldSystemFont(ofSize: 17)
Default Implementation
Declaration
Swift
func pastDateSelectedFont(calendarView: GCCalendarView) -> UIFont
Parameters
calendarView
The calendar view requesting this information.
Return Value
The selected font for past dates.
-
pastDateSelectedTextColor(calendarView:)
Default implementationAsks the delegate to provide the selected text color for past dates.
Default Value
UIColor.white
Default Implementation
Declaration
Swift
func pastDateSelectedTextColor(calendarView: GCCalendarView) -> UIColor
Parameters
calendarView
The calendar view requesting this information.
Return Value
The selected text color for past dates.
-
pastDateSelectedBackgroundColor(calendarView:)
Default implementationAsks the delegate to provide the selected background color for past dates.
Default Value
UIColor(white: 0.0, alpha: 0.87)
Default Implementation
Declaration
Swift
func pastDateSelectedBackgroundColor(calendarView: GCCalendarView) -> UIColor
Parameters
calendarView
The calendar view requesting this information.
Return Value
The selected background color for past dates.
-
currentDateFont(calendarView:)
Default implementationAsks the delegate to provide the unselected font for the current date.
Default Value
UIFont.boldSystemFont(ofSize: 17)
Default Implementation
Declaration
Swift
func currentDateFont(calendarView: GCCalendarView) -> UIFont
Parameters
calendarView
The calendar view requesting this information.
Return Value
The unselected font for the current date.
-
currentDateTextColor(calendarView:)
Default implementationAsks the delegate to provide the unselected text color for the current date.
Default Value
UIColor(red: 1.0, green: 0.23, blue: 0.19, alpha: 1.0)
Default Implementation
Declaration
Swift
func currentDateTextColor(calendarView: GCCalendarView) -> UIColor
Parameters
calendarView
The calendar view requesting this information.
Return Value
The unselected text color for the current date.
-
currentDateSelectedFont(calendarView:)
Default implementationAsks the delegate to provide the selected font for the current date.
Default Value
UIFont.boldSystemFont(ofSize: 17)
Default Implementation
Declaration
Swift
func currentDateSelectedFont(calendarView: GCCalendarView) -> UIFont
Parameters
calendarView
The calendar view requesting this information.
Return Value
The selected font for the current date.
-
currentDateSelectedTextColor(calendarView:)
Default implementationAsks the delegate to provide the selected text color for the current date.
Default Value
UIColor.white
Default Implementation
Declaration
Swift
func currentDateSelectedTextColor(calendarView: GCCalendarView) -> UIColor
Parameters
calendarView
The calendar view requesting this information.
Return Value
The selected text color for the current date.
-
currentDateSelectedBackgroundColor(calendarView:)
Default implementationAsks the delegate to provide the selected background color for the current date.
Default Value
UIColor(red: 1.0, green: 0.23, blue: 0.19, alpha: 1.0)
Default Implementation
Declaration
Swift
func currentDateSelectedBackgroundColor(calendarView: GCCalendarView) -> UIColor
Parameters
calendarView
The calendar view requesting this information.
Return Value
The selected background color for the current date.
-
futureDateFont(calendarView:)
Default implementationAsks the delegate to provide the unselected font for future dates.
Default Value
UIFont.systemFont(ofSize: 17)
Default Implementation
Declaration
Swift
func futureDateFont(calendarView: GCCalendarView) -> UIFont
Parameters
calendarView
The calendar view requesting this information.
Return Value
The unselected font for future dates.
-
futureDateTextColor(calendarView:)
Default implementationAsks the delegate to provide the unselected text color for future dates.
Default Value
UIColor(white: 0.0, alpha: 0.87)
Default Implementation
Declaration
Swift
func futureDateTextColor(calendarView: GCCalendarView) -> UIColor
Parameters
calendarView
The calendar view requesting this information.
Return Value
The unselected text color for future dates.
-
futureDateSelectedFont(calendarView:)
Default implementationAsks the delegate to provide the selected font for future dates.
Default Value
UIFont.boldSystemFont(ofSize: 17)
Default Implementation
Declaration
Swift
func futureDateSelectedFont(calendarView: GCCalendarView) -> UIFont
Parameters
calendarView
The calendar view requesting this information.
Return Value
The selected font for future dates.
-
futureDateSelectedTextColor(calendarView:)
Default implementationAsks the delegate to provide the selected text color for future dates.
Default Value
UIColor.white
Default Implementation
Declaration
Swift
func futureDateSelectedTextColor(calendarView: GCCalendarView) -> UIColor
Parameters
calendarView
The calendar view requesting this information.
Return Value
The selected text color for future dates.
-
futureDateSelectedBackgroundColor(calendarView:)
Default implementationAsks the delegate to provide the selected background color for future dates.
Default Value
UIColor(white: 0.0, alpha: 0.87)
Default Implementation
Declaration
Swift
func futureDateSelectedBackgroundColor(calendarView: GCCalendarView) -> UIColor
Parameters
calendarView
The calendar view requesting this information.
Return Value
The selected background color for future dates.