Reputation: 296
I Already Set Dates On This Method
private func calendar(_ calendar: FSCalendar, imageFor date: Date) -> UIImage? {
let day: Int! = self.gregorian.component(.day, from: date)
return [1,2,3].contains(day) ? UIImage(named: "mens") : nil
}
I would like to set it on this - It doesn't work please help me :)
func calendar(_ calendar: FSCalendar, imageFor date: Date) -> UIImage? {
let day: Int! = self.gregorian.component(.day, from: date)
return [08-10-2017, 08-11-2017].contains(day) ? UIImage(named: "mens") : nil
}
Upvotes: 1
Views: 737
Reputation: 2650
let day: Int! = self.gregorian.component(.day, from: date)
This line will return you the day. For example : - 08-10-2017 it will return 08.
So, first convert the date func calendar(_ calendar: FSCalendar, imageFor date: Date) -> UIImage?
into your dd-MM-yyyy format.
Then use this return [08-10-2017, 08-11-2017].contains(date) ? UIImage(named: "mens") : nil
Hope this helps!
Upvotes: 1