0

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.

My swift class looks like this:

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:

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'

Note: My 'projectName.h' file includes both lines @import Foundation and @import Quartz.

Any help would be greatly appreciated!

Ryan
  • 948
  • 6
  • 20

1 Answers1

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!

Ryan
  • 948
  • 6
  • 20