Then # import“ ProductModuleName-Swift.h” in your ObjC file.
Swift 4
extension UIColor {
// As of Swift 4.0.3, the @objc annotation is needed if you want to use the extension in Objective-C files
@objc
class func otherEventColor() -> UIColor {
return UIColor(red:0.525, green:0.49, blue:0.929, alpha:1)
}
}
如果认为已经正确配置了所有内容(将 Swift 实体标记为@objeccMember 或@objecc,则导入桥接头“ ProductModuleName-Swift。等等)-但仍然得到 No visible @interface for 'FooClass' declares the selector 'fooSelector'错误:
通过单击 ctrl + cmd,检查是否在桥接头 中看到了接口。如果你不这么认为,那么看看我对这个问题的回答吧: “ Swift to Objective-C”头部不包含 Swift 类