Search code examples
iosswiftcocoapodslibrariesswift-package-manager

Setting up library with CocoaPods and Swift Package Manager


I have created a swift (iOS/MacOS) library on CocoaPods (BillboardSwiftLibrary). Generally, it has its assets and Classes folders which contain the source files.

I want my library to support Swift Package Manager, so I moved the source files from the Classes folder into a Sources folder outside the pod. However, they are still accessible from the Development pods.

Now my library won't build for Cocoapods launch but compiles for Swift Package Manager, I get the error below when I run pod lib lint BillboardSwiftLibrary.podspec

ERROR | file patterns: The source_files pattern did not match any file.


Solution

  • From @Larme's comment, I found the answer.

    In your podspec file, change the location of your classes to the sources folder. So changed my s.source_files from to BillboardSwiftLibrary/Classes/**/* to Sources/**/* and pod lib lint BillboardSwiftLibrary.podspec worked fine.