I am trying to make a subclass of PDFKit's PDFView in my macOS application, which has legacy objective-c code as part of the project.
我正在尝试在macOS应用程序中创建PDFKit的PDFView的子类,该应用程序将遗留的objective-c代码作为项目的一部分。
My swift class looks like this:
我的swift类是这样的:
import Foundation
import Quartz
class customPDFView: PDFView
{
required init?(coder: NSCoder) {
super.init(coder: coder)
}
}
During the build I get an error in my 'projectName-Swift.h' file, which has created this:
在构建过程中,我在“projectName-Swift”中得到一个错误。h' file,它创建了以下内容:
SWIFT_CLASS("_TtC5NVivo13customPDFView")
@interface customPDFView : PDFView
- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder OBJC_DESIGNATED_INITIALIZER;
- (nonnull instancetype)initWithFrame:(NSRect)frameRect SWIFT_UNAVAILABLE;
@end
The second line in the above code produces the error: Cannot find interface declaration for 'PDFView', superclass of 'customPDFView'
上面代码的第二行产生错误:无法找到“PDFView”的接口声明,这是“customPDFView”的超类
Note: My 'projectName.h' file includes both lines @import Foundation
and @import Quartz
.
注意:我的“projectName。h文件包括@import Foundation和@import Quartz。
Any help would be greatly appreciated!
如有任何帮助,我们将不胜感激!
1 个解决方案
#1
0
I have found an answer so will post if anyone else ever stumbles across this issue.
我已经找到了答案,如果有人遇到这个问题,我也会发帖子。
In my <projectName>-Bridging-Header.h
file I added in the line #import <Quartz/Quartz.h>
and this solved the issue!
在我的< projectName > -Bridging-Header。h文件我添加在#import
#1
0
I have found an answer so will post if anyone else ever stumbles across this issue.
我已经找到了答案,如果有人遇到这个问题,我也会发帖子。
In my <projectName>-Bridging-Header.h
file I added in the line #import <Quartz/Quartz.h>
and this solved the issue!
在我的< projectName > -Bridging-Header。h文件我添加在#import