几乎匹配协议`JTCalendarDelegate`中的可选要求

时间:2017-11-22 12:29:36

标签: swift4 jtcalendar

以下方法在转换/迁移到Swift 4后抛出警告而无法正常工作。

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

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

参见图片以供参考:

"nearly matches optional requirement" warning

"nearly matches optional requirement" warning

1 个答案:

答案 0 :(得分:1)

在Swift 4中,这两种方法对dayView参数((UIView & JTCalendarDay)!而不是UIView!)有不同的类型:

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

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