We recently had the need to align our frameworks to one dependency management system. Previously we were using Carthage and Cocoapods (or both) amongst different frameworks. The burden of supporting both platforms coupled with long build times on our CI/CD drew us away from Carthage. During this conversion I encountered several "gotcha" moments in our Xcode projects that I want to share with others who might be doing the same thing to get you to a clean Cocoapod based build.
- You have a working knowledge of Carthage and Cocoapods
- You have a working knowledge of Xcode project settings
- If you use
bundler
you will need to add that to the commands listed
- To start with, you will want to create a Podfile and/or Podspec file that matches the dependencies defined in your Cartfile and Cartfile.private files.
- Delete the
Carthage
directory - Delete the
Cartfile
andCartfile.resolved
files (but save the libraries you want to use somewhere safe) - Ensure you do the following steps for all your Xcode targets (
build
,tests
,UI tests
,etc
) - In Xcode, highlight your project in the Navigator view, select
Build Settings -> Framework Search Paths
, delete what is there, and add this string“$(inherited)”
- Select
Build Settings -> Header Search Paths
and delete the entries - Select
Build Settings -> Other C Flags
, delete what is there, and add this string$(inherited)
- Select
Build Settings -> Always Embed Swift Standard Libraries
and delete what is there - Select
Build Phases
and deleteCopy Frameworks
- In Terminal
cd
to the parent directory of your project and runpod init
to initialize Cocoapods in the project - Run
pod install
- Ensure your
Podfile.lock
references all the libraries as your oldCartfile.resolved
- Open your new
*.xcworkspace
file and ensure that your project builds