我正在尝试从EventKit异步获取提醒(EKEntityTypeReminder)。我该如何在Swift中编写代码?
[_store fetchRemindersMatchingPredicate:predicate completion:^(NSArray *reminders) {
for (EKReminder *reminder in reminders) {
NSLog(@"Reminder %@",reminder);
}
}];
…仍在努力适应新的Blocks / Closures语法
最佳答案
store.fetchRemindersMatchingPredicate(predicate) { reminders in
for reminder in reminders {
}
}
我更喜欢使用trailing closure syntax
否则可能是...
store.fetchRemindersMatchingPredicate(predicate, completion: {(reminders: [AnyObject]!) -> Void in
for reminder in reminders {
}
})