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
bundleryou 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
Carthagedirectory - Delete the
CartfileandCartfile.resolvedfiles (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 Pathsand 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 Librariesand delete what is there - Select
Build Phasesand deleteCopy Frameworks - In Terminal
cdto the parent directory of your project and runpod initto initialize Cocoapods in the project - Run
pod install - Ensure your
Podfile.lockreferences all the libraries as your oldCartfile.resolved - Open your new
*.xcworkspacefile and ensure that your project builds
thank you so much 🤩