Search code examples
iosswiftcocoapodsxcode11swift-package-manager

Migrating from Cocoapods to Swift Package Manager but import module failed


recently I'm refactoring a project which uses Cocoapods to manage dependencies (a lot of dependencies...), since Xcode 11 integrated Swift Package Manager, I want to migrate progressively some dependencies to SPM staring from the framework Alamofire.

After I removed the Alamofire from the Podfile (delete and run pod install) and added it into SPM,

enter image description here

I got the error No such module 'Alamofire'.

enter image description here

I've already tried to clean build and removed derived data but none of them can fix it. Did anyone have this problem too?


Solution

  • After few days searching, I found out this https://stackoverflow.com/a/57312755/863020.

    Seems that SPM could be only used for Debug and Release configurations, if we want to use it with more configurations then we should write a pre-action. And it is also a known issue on Xcode so I would not use SPM for now :(

    UPDATED on dec. 12

    So I come back to my question after the new release of Xcode 11.3, it fixed this issue and now I can build the project with custom build configuration :)