CocoaPods, Dependency Manager for Swift and Objective-C


Hello and welcome back to Ask MHS, in this tutorial we're going to be learning about CocoaPods. So if you don't know what CocoaPods is, it's a dependency manager for Swift and Objective-C projects. So dependency manager is just a fancy way of saying that it's a manager for the third-party libraries that are going to be bringing into our projects.

So if you go to CocoaPods official website at cocoapods.org, you can actually search for all the pods or third-party libraries that are available via CocoaPods. So let's go ahead and get started by installing CocoaPods.

Steps :

  • Open your Terminal
  • Run sudo gem install cocoapods followed by hitting Enter
  • Type your password and hit Enter again in order to continue the processes

cocoapods introduction and how to install
It's going to install the Gem and a Gem is actually something from Ruby and luckily for us, we don't have to actually Ruby because it comes with Mac OS X or macOS.
So now we have this CocoaPods installed on our OS X or macOS and now we can start using CocoPods.

Next is setting up CocoaPods master repository. Now we have to do is running pod setup command in our Terminal or pod setup --verbose to let us see the logs. And it will download the dependency repository amount 1.4 GB.
Now we have done setting up the master repository of cocoapods in our Mac.
Then let's show just a few feature of cocoapods that are kind of handy:
- pod list
And what this is going to do is it's going to list every single cocapod that's available. So if we run this command it's going to listing all the available cocoapods.
- pod search <dependency_name>
This one is another handy feature of cocoapod that allows us to search whatever dependency we want to search. Now the great thing about cocoapod is it doesn't have to be case-sensitive, so for instance we're going to look for example Swifty JSON just by typing pod search swifty.
As we can see there are quite bit of them like Swifty-Extensions, etc. Just find what we're going to install that's SwiftyJSON then install it in our project folder.

So that's all about cocoapods. In the next tutorial we'll discuss about implementing this cocoapods into our projects so stay tune on Ask MHS and Bye!.
CocoaPods, Dependency Manager for Swift and Objective-C CocoaPods, Dependency Manager for Swift and Objective-C Reviewed by Ask MHS on November 18, 2016 Rating: 5

No comments:

Powered by Blogger.