Skip to content
Guides

Swift Compatibility

To use the ComPDFKit Objective-C Framework in your Swift project, you have to create a Swift Bridging Header file in that project. The best way is to create the .h file manually.

  1. The First Method

    First, add a header file to your project with the name: "MyProjectName-Bridging-Header.h". This will be the single header file where you import any Objective-C code that you need your Swift code to access.

    Then, find Swift Compiler - Code Generation section in your project build settings. Add the path to your bridging header file next to Objective-C Bridging Header from the project root folder. It should be "MyProject/MyProject-Bridging-Header.h".

  2. The Second Method:

    Import modules. Find the "ComPDFKit.xcframework" folder -> "ios-arm64_armv7" -> "ComPDFKit.framework" -> "Modules". Then, import the "Modules" folder entirely or just import the "Module“ files within the ”Modules“ folder. See the picture below for the details.

    2-10-2

    The subsequent operations can be configured in the same way as the configuration method of Objective-C.