oc 与swift 混编
创建oc一个项目 Swift_Objc
oc 调用swift:
创建一个类SecondViewController,选择swift 语言,创建,提示是否进行桥接,点击桥接。
在viewController,中引入Swift_Objc-Swift.h 文件,即可用oc 语言使用swift类
- - (void) presentVC
- {
- SecondViewController *secondVC = [[SecondViewController alloc]init];
- [self presentViewController:secondVC animated:YES completion:nil];
- }
swift 调用oc:
以后就是oc 与swift 混编
- override func touchesBegan(touches: Set<UITouch>,withEvent event: UIEvent?) {
- let vc = ViewController()
- self.presentViewController(vc,animated: true) { () -> Void in
- }
- }