我正在尝试在我的 macOS 应用程序中创建 PDFKit 的 PDFView 的子类,该应用程序将遗留的 Objective-c 代码作为项目的一部分。
我的快速课程如下所示:
import Foundation
import Quartz
class customPDFView: PDFView
{
required init?(coder: NSCoder) {
super.init(coder: coder)
}
}
在构建期间,我的“projectName-Swift.h”文件中出现错误,该文件创建了这个:
SWIFT_CLASS("_TtC5NVivo13customPDFView")
@interface customPDFView : PDFView
- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder OBJC_DESIGNATED_INITIALIZER;
- (nonnull instancetype)initWithFrame:(NSRect)frameRect SWIFT_UNAVAILABLE;
@end
上面代码中的第二行产生了错误:
Cannot find interface declaration for 'PDFView', superclass of 'customPDFView'
注意:我的 'projectName.h' 文件包括行@import Foundation
和@import Quartz
.
任何帮助将不胜感激!