iosobjective-cswiftxcodemupdf

Could not build Objective-C module 'mupdfdk'


I'm trying to add mupdf framework to a swift project. I created a new project and copied the mupdfdk.framework to my project and referenced it in the frameworks section. Following is a screenshot of the documentation.

enter image description here

Now my project looks like this.

enter image description here

Then when I try to import it in viewcontroller, I get Could not build Objective-C module 'mupdfdk' error. Are there any other steps I'm missing? Please help.


Solution

  • You need to add this bridging header:

    MuPDF-Bridging-Header.h

    #ifndef MuPDF_Bridging_Header_h
    #define MuPDF_Bridging_Header_h
    #import "mupdfdk.framework/Headers/mupdfdk.h"
    #endif /* MuPDF_Bridging_Header_h */
    

    and declare it within the Swift Compiler section of the Build Settings:

    enter image description here