3

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

Benjamin RD
  • 11,516
  • 14
  • 87
  • 157
user3036749
  • 95
  • 2
  • 8
  • set path for bridging header – Devendra Agnihotri Apr 22 '16 at 07:49
  • i did this but same error agaion – user3036749 Apr 22 '16 at 10:42
  • @ user3036749 - May be you deleted your framework but reference is still available .Remove your frameworks from your project then again add framework then clean your project then build your project .It will work fine.Happy coding. – Devendra Agnihotri Apr 27 '16 at 08:23
  • Does this answer your question? [Xcode 6 / Beta 4: using bridging headers with framework targets is unsupported](https://stackoverflow.com/questions/24875745/xcode-6-beta-4-using-bridging-headers-with-framework-targets-is-unsupported) – patric.schenke Dec 05 '19 at 15:14

1 Answers1

2

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 )

black_pearl
  • 2,549
  • 1
  • 23
  • 36