How to include libsignal-protocol-c in my Swift iOS app?

745 views Asked by At

I would like to write something like import SignalProtocol at the top of one of my Swift files and then be able to call the C functions from libsignal-protocol-c.

libsignal-protocol-c's README says: "When integrating into actual applications, you should not need anything beyond CMake. Alternatively, you may integrate the code using a build system of your choice."

I think I'd like to use the Swift Package Manager to integrate libsignal-protocol-c into my Swift iOS app. Is there a way to automatically generate a manifest file, ie, Package.swift, and a module map, ie, a module.modulemap file, from libsignal-protocol-c's CMake files? Or if I need to create these files manually, what should they include? Otherwise, how would I do this with CMake?

How to import and use libsignal-protocol-c in an existing .xcodeProj? is a similar question but for Objective-C projects.

2

There are 2 answers

2
Denis On

I'm not sure its an answer but I'm going to start using https://github.com/christophhagen/LibSignalProtocolSwift. Seems like a good start.

0
Daniel Wallman On

You can import libsignal with CocoaPods, see https://github.com/signalapp/libsignal/blob/main/swift/README.md