oc swift混编是swift如何反向传值给oc页面
用到的知识就是swift的闭包原理。
swift页面:返回的值是一个字典
typealias chidernInfo = (NSDictionary)->Void
var childern: chidernInfo?
在button点击的方法里面实现:
self.childern!(someDict)
在需要实现闭包的方法:
// 闭包方法 func returnChlidernInfo(name: chidernInfo) { self.childern = name }
oc 页面:
在点击页面跳转的方法里面如下实现:
swiftClass *vc = [[swiftClass alloc] init]; [vc returnChlidernInfo:^(NSDictionary * _Nonnull childern) { LOG(@"---%@",childern); }]; [self presentViewController:[[BaseNavController alloc] initWithRootViewController:vc] animated:YES completion:nil];
注意的是:这是由oc页面跳转到swift页面,反向传值。

浙公网安备 33010602011771号