CocoaPods has became very popular among cocoa developers, due to its simplicity and tremendous help. With CocoaPods and Swift you can be very productive in your day-to-day coding life. By simply checking the name of the desired repository in CocoaPods library and including it into your
First of all, you will have to install CocoaPods. It is quite simple. All you have to do is to run this command in your Terminal app, with administrator privileges:
$ sudo gem install cocoapods # Before OS X El Capitan $ sudo gem install -n /usr/local/bin cocoapods # OS X El Capitan
Now you have CocoaPods installed and you are almost ready to use it. Next step is to navigate to your project folder and create there file named
$ pod init
In case you have created it with terminal command, delete the boilerplate code to have an empty file.
Once you have it, you will need to provide some basic info about which dependencies you want to install as well as which platform you are using. Sample
platform :ios, '8.0' pod 'ARSPopover', '~> 2.0' pod 'ARSSlideTransition', '~> 1.0'
In case you want to download all new versions of the framework, you have to specify only name of he framework, like this:
After your Podilfe is up and ready, you need to run this command in Terminal app, while being inside your project's folder:
$ pod install
This will take a while, depending on you network connection and dependencies sizes. In case nothing happens or you have an error - double check that you are in the project's folder.
After this command, CocoaPods will create new file, named
Using libraries in code
Once you have done all of the above steps and opened your new
Aaaaand this is it, you are done!
Once in a while you will want to see if you have any updates to your dependencies. To check if there are any and to install them right away - use this command in Terminal app, while being in the project's folder:
$ pod install