How to install Cocoapods ?




How to install cocoapods in a fresh new Mac Mini, iMac..

Just follows my Steps ->

Step1) You need to Install Cocoapods in your macOS. Cocoapods use Ruby Language which ships with all versions of macOS X.

Open Terminal (Windows + Space ) or (Command + Space) 
Type Terminal click Enter


Here we go.........>>>>>>>
Paste this command in your terminal. and hit Enter.

  sudo gem install cocoapods                                                                  




It will Required your mac password. if required just enter your password.
This command you will use only once for your macOS X.

Step2) Now you have to complete the setup use this command. once the previous command will complete use this command and wait till completion.


  pod setup --verbose                                                                                     


This command you will use only once to setup cocoapods in  your macOS X.

NOTE:-  pod setup --verbose  to run this command it will take few minutes of time so don't get confused because it downloads some data from cocoapods server, Basically it clones.
 CocoaPods Master Specs repository  into  ~/.cocoapods/ on your computer.


Step3) Now Cocoapods Successfully Installed in your system. you can use any third-party framework in your Xcode project following a few steps. 

1. Create a new Xcode project
2. Now again open Terminal
3. Type: cd
4. Drag your project in the terminal and drop it here to set up path to your project. or you can manually type your project path, as you wish.


Now hit Enter. 

Initial Project files.




5. Now use this command to initialize your project
  pod init                                                                                     

 this command will add a podfile in your project.

6. Now you have to open this podfile to past framework name. Use this simple command.

 open podfile                                                                                     
or you can use this command to open podfile using Xcode.
  open podfile -a Xcode                                                      




7. Now use this link to Search Framwork Cocapods or you can directly search on Google.



it is just an example you can use any framework. I used Almofire for API Calling.

Just Copy this line of code   pod 'Alamofire', '~> 5.2'
and Go to your podfile which you opened previously using Command open podfile.
Paste it there # Pods for MyTest
NOTE:- you can remove the version name from last like pod 'Alamofire'



8. N
ow save it.  click (Windows + S) or (Command + S)

9.  Now you have to Install that framework in your project uses simple command.

  pod install                                                                                     

Hit Enter. it will start insaliing latest and compatible version of framework. just wait for the success.



10. Now Open your project you will see a few new files added to your project.


Now you have to use Mytest.xcworkspace always to open your project. double click on Mytest.xcworkspace to open. 




THANKYOU








Comments