Reputation: 1147
I thought about using a bridging header, but I keep getting fail to import bridging header. Is it possible for watch extension (written in swift) to use code from the iOS App (written in Objective C)? I need to make sure I am doing this correctly and professionally. If I can use bridging header, why am I getting the following error?
:0: error: failed to import bridging header
Upvotes: 4
Views: 1419
Reputation: 1534
It might something as simple as a path problem. But what I normally do is create a dummy Objective-C file so that Xcode will create that bridging header for me, then I just copy and paste the path into the extension's build settings.
I've included a demo project which calls a method from an Objective-C file that is imported in the bridging header. I've also had to add the file in the extension's build phases for it to work. I hope this is what you're looking to solve.
https://dl.dropboxusercontent.com/u/5296996/WKTest.zip
Upvotes: 1