Search code examples
iosswiftswift-package-manager

Automatic Third Party Libraries Acknowledgements and Licences added with Swift Package Manager


I am using the Swift Package Manger (SPM) to add third party libraries to my iOS application. I would like to display acknowledgements and their respected licences. In the old CocoaPod days this was possible with several libraries (e.g. this one). Is there a way to achieve the similar things with SPM?

I am looking for

  1. An automated solution which generates licence information when a new dependencies is added/removed via SPM.
  2. Offers a UIViewController or Settings.bundle where the licences are displayed.

This doesn't have to be a library but can also be a build script. Item 2 could also be done by myself.


Solution

  • I have found a great Library called LicensePlist, which does exactly what you asked for. The SPM support is still a bit lacking, however check out their GitHub Page for the exact installation instructions.

    You create a settings bundle and add a Build Phase (explained on the LicensePlist Github Page). The library generates a .plist file for each library in your Settings Bundle and also generates a file that automatically adds a submenu in the in-app settings where all the Licenses are listed by name.