2

I am trying to get the Swift Charts library for iOS working in my Objective-C project. Here's what I've done so far:

(1) Installed the Charts pod

(2) Under "Build Options", set "Embedded Content Contains Swift Code" to YES

(3) Followed the Apple doc for importing external frameworks and put '@import Charts;' in one of my .m files. I set the Defines Modules to YES in my project Target--which makes Xcode recognize the import statement. BUT the doc says to set it in the Framework--which I don't know how to access that--so that may be the problem?

I'm getting many errors popping up in files of the Charts Cocoapod itself (Things like "Expected ',' separator"), which I'm sure is not because they are actual errors (this is a well maintained library), but because something is not hooked up right. What am I doing wrong?

1 Answer 1

2

I have used ChartsPod recently in objective-c project. Yes it was headache to set up Chart Pods with the project. Few things you need to look carefully while importing swift pod.

  • Follow author instructions carefully.
  • Have you created Bridging Header to tell compiler it's a swift code? If not then read authors instructions carefully (Chart-iOS) or read BridgingHeader

  • In Target->Build Phases->Target Dependencies add Chart-iOS

Hope this will help.

Sign up to request clarification or add additional context in comments.

2 Comments

Yes I've already created the Bridging Header and added the dependency to my target.
The you provided to the Apple docs did the trick. I was importing a CocoaPod made with Swift. My import statement needed to be #import <MyLib/MyLib-Swift.h> instead of the MyProject-Swift.h.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.