0

I'm trying to get the date that the user selects via the didSelectDate function, but it's not getting called.

Here's my code:

func calendar(calendar: FSCalendar!, didSelectDate date: Date!) {
    print ("this func is getting called")
}

What's the problem?

Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223
Farbod
  • 83
  • 1
  • 10

2 Answers2

3

Swift 4

func calendar(_ calendar: FSCalendar, didSelect date: Date, at monthPosition: FSCalendarMonthPosition){

     print("date is selected \(self.formatter.string(from: date))"

}
Bhavesh Nayi
  • 3,626
  • 1
  • 27
  • 42
wammy
  • 53
  • 1
  • 5
2

In Swift 3, the method changed a little. Replace

func calendar(calendar: FSCalendar!, didSelectDate date: Date!)

with

func calendar(_ calendar: FSCalendar, didSelect date: Date)
Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223