user3036749
user3036749

Reputation: 95

error: using bridging headers with framework targets is unsupported

I have a Objective C Cocoa Framework I want to use a Swift file in my framework but I added a Bridging Header file with name <Project-name>-Swift.h line. But, when I run it, the output is:

:0: error: using bridging headers with framework targets is unsupported

Upvotes: 3

Views: 5580

Answers (1)

black_pearl
black_pearl

Reputation: 2699

umbrella framwork solves

  • bridging headers for projects

  • umbrella file for frameworks


here is an example:

two files needed

fisherWebP-umbrella.h

&

fisherWebP.modulemap

111

where to place them

00

in fisherWebP.modulemap:

framework module Kingfisher{
  umbrella header "fisherWebP-umbrella.h"

  export *
  module * { export * }
}

in fisherWebP-umbrella.h

#ifdef __OBJC__
#import <UIKit/UIKit.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif



#import "demux.h"
#import "mux.h"
#import "decode.h"
// what you need

in Xcode,

you need fisherWebP-umbrella.h

not fisherWebP.modulemap

00099

then set fisherWebP-umbrella.h

in settings , Packaging Options,

999

PS:

you need set fisherWebP-umbrella.h as public

99999

files imported in fisherWebP-umbrella.h, should set as public too.

such as : demux.h

888

do this recursively.

PPS:

set OTHER_SWIFT_FLAGS to -Xcc -Wno-error=non-modular-include-in-framework-module inhibit swift import error.

( Include of non-modular header inside framework module )

Upvotes: 2

Related Questions