Adding a static library (.a) file to Swift iOS project



I have a library provided to me by a hardware supplier and I’m looking to add it to an existing iOS Swift project which currently uses Cocoapods to manage its existing libraries.

The library comes with an example project but it seems very outdated and I can’t understand how it works.

I’ve tried many ways to add the library to the Swift project such as pointing directly to the .a file in the Link binary with libraries section of the project Build Phases tab and I also tried to create a new Cocoapod using Podspec file referencing the .a and header files included with the static library although I’m not sure if I did this right or if it’s possible with .a files. All these approaches have resulted in the same No such module error when I try to reference it in my Swift iOS project.

In short, what’s the best way to go about adding a static library comprised of .a and .h files to an existing Swift iOS project? It would be preferable to add it with Cocoapods to keep it consistent with the other libraries but if this isn’t possible then an alternative would work as well.

Please forgive my ignorance as I’m very new to iOS development.