我可以将这个可选的obj-c委托方法移植到swift吗?
- (void)popupStoreEventWasEmitted:(PopupStoreController *)controller withEvent:(NSString*)eventName withPayload:(NSDictionary *)payload;
我已经尝试过AnyObject(可选和必需),NSDictionary,Dictionary(可选和必需),String和NSString(可选和必需)等的所有可能组合。但无论它陈述错误:
/FastDev/Classes/TDTFinishingViewController.swift:884:14:Objective-C方法'popupStoreEventWasEmitted:withEvent:withPayload:'由方法提供'popupStoreEventWasEmitted(:withEvent:withPayload :)'与可选的需求方法'popupStoreEventWasEmitted(: withEvent:withPayload :)'在协议'PopupStoreControllerDelegate'
中我有什么地方可以找到swift委托方法的样子吗?
答案 0 :(得分:0)
如果您刚开始输入方法名称,Xcode应该为您自动填充它。我明白了:
func popupStoreEventWasEmitted(controller: PopupStoreController!,
withEvent eventName: String!,
withPayload payload: [NSObject : AnyObject]!)
{
}