2

I want to import some swift classes in objective-c project. I added all classes, I created the bridging-header, I imported the MyTarget-swift.h file in my classes and everything seems working fine.

When I'm building the project, I found a very strange error on generated swift.h file:

enter image description here

StoreKit framework is already added to project. I have no idea what is going on. Anybody has any idea?

Gaby Fitcal
  • 1,814
  • 1
  • 17
  • 28
  • Clean your project and try again. I sometimes get these weird errors because of stale build data. Let me know how that goes. – jvarela Nov 15 '18 at 02:01
  • This not solve my problem. I already tried billion times. Also Analyze. Delete derivered data. Nothing works – Gaby Fitcal Nov 15 '18 at 06:59

1 Answers1

2

The right answer is this: https://stackoverflow.com/a/24195188/4563329

That helped me to fix my problem. I will post my fixed file here:

I created another header file in objective-c named ModuleTargetName-Swift-Fixed.h Inside of it first I imported StoreKit and after I imported ModuleTargetName-Swift.h. In my objective-c classes I imported ModuleTargetName-Swift-Fixed.h

This is my class:

// Forward declarations for property classes
#import <StoreKit/StoreKit.h>

// Imports for superclasses
#import "ModuleTargetName-Swift.h"
Gaby Fitcal
  • 1,814
  • 1
  • 17
  • 28