Я новичок в сегодняшнем расширении, у меня есть это предупреждение, кто-нибудь знает, как соответствовать необязательному требованию?Метод экземпляра 'widgetPerformUpdate (completeHandler :)' почти соответствует необязательному требованию 'widgetPerformUpdate (completeHandler :)'
метод экземпляра 'widgetPerformUpdate (completionHandler :) почти соответствует факультативное требование 'widgetPerformUpdate (completionHandler :)' протокола '' NCWidgetProviding
func widgetPerformUpdate(completionHandler: ((NCUpdateResult) -> Void)) {
// Perform any setup necessary in order to update the view.
// If an error is encountered, use NCUpdateResult.Failed
// If there's no update required, use NCUpdateResult.NoData
// If there's an update, use NCUpdateResult.NewData
let result = performFetch()
if result == .newData{
tableView.reloadData()
self.preferredContentSize = tableView.contentSize
}
completionHandler(result)
}
Попробуйте 'func widgetPerformUpdate (completeHandler: @escaping (NCUpdateResult) -> Void) {' – rmaddy
@rmaddy, он работает! –