Parv Bhasker
Parv Bhasker

Reputation: 1901

Objective-C bridging header file not found

I have a class name AppState which is using a swift class object

#import "Sonic-Swift.h"

@interface AppState : NSObject
@property (class) NSMutableArray<"Swift class" *> *entity;

Now I need to use this class (AppState) in the swift file. So I'm trying to import this class in the bridging header.

But after importing this file the app gives an error on the "#import "Sonic-Swift.h"" line "File not found".

failed to emit precompiled header '/Users/krishna_mac_2/Library/Developer/Xcode/DerivedData/Apps-gqelclyzwvyomhcchmjjsejrznaw/Build/Intermediates.noindex/PrecompiledHeaders/Sonic-Bridging-Header-swift_3RJ3MQEOEFTPD-clang_26Q2UBYWMY12Y.pch' for bridging header '/Users/krishna_mac_2/Documents/Documents/Documents/Documents/Documents/Github/Sonic/iOS/Sonic/Sonic-Bridging-Header.h'

Upvotes: 1

Views: 346

Answers (1)

Prashant Tukadiya
Prashant Tukadiya

Reputation: 16446

import "Sonic-Swift.h" 

should be in .m file only.

If you want to use Swift class in .h file then you should use

@class MySwiftClass;

Upvotes: 4

Related Questions