CitrusLeaf Journal

Thoughts on software, design, technologies

Cocoapods: Working

6 months ago · 1 MIN READ
#iOS  #Cocoapods  #swift  #Native Application Development 

Introduction: CocoaPods manages library dependencies for your Xcode projects. https://cocoapods.org/

Installation: There are 2 ways to install CocoaPods :

Steps:

  • Open a terminal
  • navigate to project folder(containing projectname.xcodeproj).
  • enter command pod init
  • this will create a Podfile in your project folder.
  • do not open the Podfile in the terminal.
  • open Podfile in the Xcode using command open -a Xcode Podfile.
  • go to https://cocoapods.org/.
  • Search for the dependency e.g Alamofire.
  • Expand Alamofire
  • Click on the button "Installation Guide" located on right side(Scroll down a bit).
  • Copy and paste pod 'Alamofire', '~> 4.5' into your Podfile
  • target 'MyApp' do
  • pod 'Alamofire', '~> 4.5'
  • end
  • save it.
  • go back to your terminal.
  • type command pod install and press enter.
  • It will add the dependency.
  • Now open finder go to your project folder and open ProjectName.xcworkspace
  • Don't open the project from Xcode it will by default open .xcodeproj.
  • And you won't be able to resolve the module you imported in that.
  • After you open the project.
  • Before importing the module build the project.
  • after the build succeeds feel free to use it.

···

Amrit Rathi



Proudly powered by Canvas · Sign In