我有一个模型
@interface Section : NSObject
@property (nonatomic, strong) NSString *sectionId;
@property (nonatomic, strong) NSString *title;
+(instancetype)createObject:(NSDictionary *)sectionInfo;
@end我的桥接头如下所示
// MyProj-Bridging-Header.h
#ifndef MyProj_Bridging_Header_h
#define MyProj_Bridging_Header_h
#import "Section.h"
#endif /* MyProj_Bridging_Header_h */我的Swift控制器看起来像这样
@objc class SampleSwiftVC : UIViewController {
var supportedSectionInfo: Section?
}我开始收到编译时错误,比如
/*PathToProject*/Section.h:17:39: error: expected a type
+(instancetype)createObject:(NSDictionary *)sectionInfo;
^
<unknown>:0: error: failed to import bridging header '/*PathToProject*/MyProj-Bridging-Header.h'我转到构建设置,发现头文件引用是为Objective-C Bridging header键设置的

https://stackoverflow.com/questions/41359133
复制相似问题