Do you know how to save app updating time using Cocoapods?
No? Don’t worry, invest your next 15 mins on this blog, and you will be able to use Cocoapods as 1-2-3.
But, before we move on to the implementation part, let’s overview Cocoapods.
Cocoapods is a dependency manager for managing third-party libraries. In simple words, it is a perfect tool to manage library dependencies and scale your project elegantly.
Check this screenshot from SlideShare:
If you’re developing a mobile app with the help of third-party libraries, you can use Cocoapods to save your time that you take to update third party libraries manually.
It can save you the trouble of typing countless lines of codes to update libraries of third-parties. It can directly fetch library codes, resolve the dependencies, and help you set up the right environment for your projects.
Open your Android studio and create a new project from the file menu. Here, we’ve used ‘Single View Application’ as a template to create a short demo.
After you create a new project, install pod on your mac.
Just type ‘Terminal’ in spotlight search and open.
Type the following commands.
sudo gem install cocoapods
For mac 10.11 El Capitan, enter the following command.
sudo gem install -n /usr/local/bin cocoapods
By performing above commands, a pod will be installed on your mac. Now, it’s time to pod setup in your project.
Again, open the terminal, if you’ve closed it, and move it to your XCode project directory path by the following command.
cd “YOUR XCODE PROJECT PATH”
Create a new pod file in your project with the following command.
Now, open the pod file that we just created.
open -e podfile
Next, open your browser and open https://cocoapods.org/ and search for ‘AFNetworking’ and get its pod with the latest version.
Add this pod in “podfile”
pod 'AFNetworking', '~> 3.1'
Save and close this file and install the pod by the following command.
Once your pod is installed, open your workspace and start coding.
Congratulations! Now you know how to successfully use Cocoapods in your projects and you’re ready to start using it. However, you can do a lot more in Cocoapods such as finding a specific version of a library or it can also save you the trouble of downloading that specific version of the library by searching it online.
Nowadays, most of the mobile applications like Square Sized and EmojiGram needs third-party libraries, therefore developing your mobile app with Cocoapods Swift makes it cost-effective.
If you have an app idea similar to Instagram or Uber or any other type of application which uses a third-party library, you can contact us. We’re a top mobile app development company, and we’ve recently developed an app like Uber for our client. So, if you’ve such an idea, you can discuss it with our product manager.
You can also get a free copy of this demo at Github here.
If you’ve any questions related to this blog, do comment it down. We will get back to you as soon as possible.This page was last edited on September 13th, 2016, at 18:24.
Get your free consultation now