I am using Swift 2 and JTAppleCalendar Cocoa Pod for building my Calendar in my app.
I am trying to implement the function configureCalendar
which is the only function in the protocol JTAppleCalendarViewDataSource
.
this is the definition of the function as given by the pod:
func configureCalendar(calendar: JTAppleCalendarView) -> (startDate: NSDate, endDate: NSDate, numberOfRows: Int, calendar: NSCalendar)
This is my implementation:
extension CalendarViewController: JTAppleCalendarViewDataSource {
func configureCalendar(calendar: JTAppleCalendarView) -> (startDate: NSDate, endDate: NSDate, numberOfRows: Int, calendar: NSCalendar) {
formatter.dateFormat = "yyyy MM dd"
formatter.timeZone = NSCalendar.currentCalendar().timeZone
formatter.locale = NSCalendar.currentCalendar().locale
let startDate = formatter.dateFromString("2017 01 01")
let endDate = formatter.dateFromString("2017 12 31")
let calendar = NSCalendar.currentCalendar()
return (startDate!, endDate!, 5, calendar)
}
}
I get this error from the compiler:
CalendarViewController.swift:32:1: Type 'CalendarViewController' does not conform to protocol 'JTAppleCalendarViewDataSource'
JTAppleCalendar.JTAppleCalendarViewDataSource:11:17: Protocol requires function 'configureCalendar' with type '(JTAppleCalendarView) -> (startDate: NSDate, endDate: NSDate, numberOfRows: Int, calendar: NSCalendar)'
Why am I not conforming the protocol?