SIAlertView внешний Objective C библиотеки я использую в моем проектеSwift 3 Перерывы Мой Objective C и Swift Handler/Closure Совместимость
В Swift 2.2 эта линия ниже отлично компилируется
class func showAlert(title title : String, message: String, confirmHandler: (SIAlertView!) -> Void) {
...
alertView.addButtonWithTitle(OK_TITLE, type: SIAlertViewButtonType.Default, handler: confirmHandler);
alertView.show();
}
Но теперь в Swift 3 появляется сообщение об ошибке
Cannot convert value of type 'class func showAlert(title title : String, message: String, confirmHandler: (SIAlertView!) -> Void)' to expected argument type 'SIAlertViewHandler!'
От Objective класса C Я считаю, что
SIAlertView.h
@class SIAlertView;
typedef void(^SIAlertViewHandler)(SIAlertView *alertView);
SIAlertView.m
- (void)addButtonWithTitle:(NSString *)title type:(SIAlertViewButtonType)type handler:(SIAlertViewHandler)handler
{
SIAlertItem *item = [[SIAlertItem alloc] init];
item.title = title;
item.type = type;
item.action = handler;
[self.items addObject:item];
}
Может ли кто-нибудь объяснить это, пожалуйста? Потому что ранее отлично работает в Swift 2.2