Nearly matches optional requirement in of protocol `JTCalendarDelegate`

218 Views Asked by At

The following methods are throwing a warning and not working after converting/migrating to Swift 4.

public func calendar(_ calendar: JTCalendarManager!, prepareDayView dayView: UIView!)

public func calendar(_ calendar: JTCalendarManager!, didTouchDayView dayView: UIView!)

See the images for reference:

"nearly matches optional requirement" warning

"nearly matches optional requirement" warning

1

There are 1 best solutions below

1
Tamás Sengel On BEST ANSWER

In Swift 4, these two methods have different types for the dayView argument ((UIView & JTCalendarDay)! instead of UIView!):

func calendar(_ calendar: JTCalendarManager!, prepareDayView dayView: (UIView & JTCalendarDay)!)

func calendar(_ calendar: JTCalendarManager!, didTouchDayView dayView: (UIView & JTCalendarDay)!)