🥥CocoaPods
Fall 2023 | Vin Bui
What is CocoaPods?
CocoaPods is a dependency manager for Swift and Objective-C projects in Xcode. It is used in over 3 million apps and contains over 95 thousand libraries. It is similar to pip for Python and npm for NodeJS. In other words, you can use code written by other people in your own Xcode project to make your life easier!
CocoaPods Setup
To install CocoaPods, simply run the following in the command line:
sudo gem install cocoapods
Navigate to your Xcode project directory and run this command:
pod init
. This creates aPodfile
in your directory.Open the
Podfile
and list out the pods you want to install. For example, if I wanted to install the latest version of SnapKit and Alamofire, myPodfile
would look something like this:
Change ‘MyApp’ to the name of your project.
Once you are done, save your
Podfile
and install the dependencies by runningpod install
If this command does not work, try
pod install --repo-update
You must open the Xcode workspace instead of the project when using CocoaPods!
Last updated