Home > Blockchain >  can I put my .a library from my objective-c project to my swift project with pods installed?
can I put my .a library from my objective-c project to my swift project with pods installed?

Time:11-24

I have a library with .a format in my objective-c project. and I want to run it in my swift project that already installed cocoapods. my plan is I want to use that .a library and then convert my code to swift in my swift project and if that not possible I will use objective-c again along with swift code in other class. so my problem is I already copy my .a library in Frameworks folder in that generated by pods. but when I build it, it says library not found. maybe because I not declare it in podsfile. but it not pods library, it external library from what I understand. is that any solution of this? because my library is must not available in cocoapods. really appreciate for the answer

enter image description here

CodePudding user response:

Don't put it in the frameworks folder generated by cocoapods. Make a new folder (e.g. libs/) and put it there.

Then:

  1. Click on your project in the file navigator
  2. In the main section, click on your target
  3. Click on the "Build Phases" tab
  4. In the "Link Binary with Libraries" section, add your .a file

Xcode screenshot showing where each part is from the instructions

  • Related