var nextScheduleDate:NSDate?
calendar.enumerateDates(startingAfter: referenceDate, matching: components, matchingPolicy: .nextTimePreservingSmallerComponents) {
(scheduleDate: Date?, exactMatch: Bool, stop: inout UnsafeMutablePointer<ObjCBool>?) in
答案 0 :(得分:0)
不要在(回调)闭包中注释解决问题的类型
calendar.enumerateDates(startingAfter: referenceDate,
matching: components,
matchingPolicy: .nextTimePreservingSmallerComponents) {
(scheduleDate, exactMatch, stop) in
...
找出正确语法的简单方法是注释掉行,重新键入第一个字符并使用代码完成,您将看到实际的闭包签名
(约会?,Bool,inout Bool)
这正是错误消息所指的签名。
顺便说一下,在Swift 3中,日期有一个原生结构Date
:
var nextScheduleDate: Date?