Swift闭包作为参数传递给objective-c

时间:2017-08-15 01:39:05

标签: swift closures block

我想通过Dictionary将闭包传递给objective-c类。 如何实现呢?

在我的快速课程中:

let printTest: (_ para: String)->Void = { word  in
    print(word)
}

var dic = ["element":printTest]
var vc = CustomViewController()
vc.dict = dic
self.navigationController?.pushViewController(vc, animated: true)

如何在Objective-c类中从dict中获得闭包?以及如何调用printTest?

0 个答案:

没有答案