如何将这行Objective-C代码转换为Swift?

时间:2015-05-07 08:21:05

标签: ios objective-c swift

@protocol YozioMetaDataCallbackable <NSObject>

/**
 * implement this method to handle the callback from new install or deeplink.
 *
 * @param targetViewControllerName - the target view controller that you configured in Yozio Web Console.
 * @param metaData - the meta data passed to your app.
 */
- (void) onCallbackWithTargetViewControllerName:(NSString *)targetViewControllerName
                                    andMetaData:(NSDictionary *)metaData;

@end

我尝试将其子类化为Swift:

class YozioCaller: NSObject , YozioMetaDataCallbackable {
    func onCallbackWithTargetViewControllerName(targetViewControllerName: NSString!, andMetaData metaData: NSDictionary!){
    }
}

但它声明它不符合。

1 个答案:

答案 0 :(得分:3)

在swift中,对NSString使用String,对NSDictionary使用[NSObject:AnyObject]。

@import