我不知道如何在混合语言项目中从 Objective C VC 引用 Swift VC。这是 Objective-C 代码:
#import "NamesVC."
... ([segue.identifier isEqualToString:@"peopleSegue"]){
NamesVC *vc = segue.destinationViewController;
vc.selEntity = @"People";
vc.delegateMethod= @"Admin";
}
桥接头:Version10-Bridging-Header.h
#ifndef Version10_Bridging_Header_h
#define Version10_Bridging_Header_h
#import "AppDelegate.h"
#import "AdminTVC.h"
如何通过 Swift VC import
到 Obj C 类中?
最佳答案
将 ProjectModuleName-swift.h
header 导入到您要像这样访问 Swift Controller 的 .m
文件中。
#import "ProjectModuleName-Swift.h"
之后,您就可以在您的 Objective c ViewController
中访问 NamesVC
。
有关此内容的更多信息,请阅读 Apple documentation在 同一项目中的 Swift 和 Objective-C
上,在本文档中阅读有关将 Swift 导入 Objective-C
关于ios - 从 Objective C View Controller 引用 Swift View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39292424/