Can't find Objective C file

72 Views Asked by At

So I'm not to up on Objective-C so I apologize if this is a basic question but I can't seem to find someone with my exact problem. I added the JBChartView(written in Objective-C) Cocoapod to a Swift project. The chart is good to go and fully up and running. However I then added some other separate Objective-C files and when trying to import a file from JBChartView it can't be found. What gives, I can access this Objective-C library from Swift files but not Objective-C files. Any ideas?

Below is everything I have tried.

#import "JBChartView.h"
#import <JBChartView/JBChartView.h>
1

There are 1 best solutions below

0
On

You don't really give us much to go on here, but if you're able to import the framework successfully using Swift, then the framework is probably defining a module. In this case, you can just take the import statement you're using in Swift, add a @ to the beginning of it and ; to the end of it and you've got a module import for Objective-C. So, if the import in Swift looks like:

import JBChartView

then you can do this in Objective-C:

@import JBChartView;

The mechanism is the same in both cases, so if one works, the other should too.