Creating iOS framework with CocoaPods, Carthage, SPM support and Travis for running test and Fastlane for release automation — Part 2

Orçun Deniz
2 min readMay 3, 2020

Creating Swift framework is easy but adding CocoaPods, Carthage and Swift Package Manager support at the same time can sounds like scary in the first place. In addition to that adding Travis to run test for all commits and adding Fastlane to automate release processes for all dependency managers looks like a horror movie. But don’t be afraid. After you finished this series, you can easily create your own Swift frameworks that uses all these tools to make it perfect!

This series consist of 5 parts:

Part 1 — Create CocoaPod and release it.

Part 2 — Add Carthage support

Part 3 — Add Swift Package Manager support

Part 4 — Integrate Travis to build example project and run tests for framework

Part 5 — Integrate Fastlane to automate release processes by running just one line of command.

  1. Get Carthage by running brew install carthage or choose another installation method

2. Open ODCustomFramework.workspace and select “Manage Schemes…”:

3. Uncheck/Check shared box for ODCustomFramework:

4. Run following command to build Carthage

cd ODCustomFrameworkcarthage build --no-skip-current

5. Commit and push all changes to the GitHub.

git add .
git commit -m "Carthage support"
git push

Now that ODCustomFramework can be installed via Carthage. Time to add Swift Package Manager support:

Part 3 — Add Swift Package Manager support

--

--