Tag Archives: pod

Using Cocoapods

ref – http://stackoverflow.com/questions/23755974/cocoapods-pod-install-takes-forever

How to install CocoaPods and setup with your Xcode project

https://www.raywenderlich.com/156971/cocoapods-tutorial-swift-getting-started

Install cocoapods

First, install pod:

The verbose option logs progress as the process runs, allowing you to watch the process instead of seeing a seemingly “frozen” screen.

Note: If you have previously installed pod and want to do a re-install do this:

Create a xCode project

Open Terminal and navigate to the directory that contains your project by using the cd command:

cd ~/Path/To/Folder/YourProject

Next, enter the following command:

Go into the root directory of the project.

This creates a Podfile for your project.
Finally, type the following command to open the Podfile using Xcode for editing:

Note: You shouldn’t use TextEdit to edit the Podfile because it replaces standard quotes with more graphically appealing typeset quotes. This can cause CocoaPods to become confused and throw errors, so it’s best to use Xcode or another programming text editor to edit your Podfile.

The default Podfile looks like this:

Delete the # and space before platform, and delete the other lines starting with #.
Your Podfile should now look like this:

This tells CocoaPods your project is targeting iOS 9.0 and will be using frameworks instead of static libraries.
In order to use CocoaPods written in Swift, you must explicitly include use_frameworks! to opt into using frameworks. If you forget to include this, and CocoaPods detects you’re trying to use a Swift CocoaPod, you’ll get an error when you try to install the pods.

Installing your Dependency

It’s finally time to add your first dependency using CocoaPods. Add the following to your Podfile, right after use_frameworks!:

This tells CocoaPods you want to include Alamofire version 4.4.0 – the latest, stable version at the time of writing this tutorial – as a dependency for your project.
Save and close the Podfile.

You now need to tell CocoaPods to install the dependencies for your project. Enter the following command in Terminal, after ensuring you’re still in the directory containing your project and Podfile:

You should see output similar to the following:
Analyzing dependencies
Downloading dependencies
Installing Alamofire (4.4.0)
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use YourProject.xcworkspace for this project from now on.
Open the project folder using Finder, and you’ll see CocoaPods created a new YourProject.xcworkspace file and a Pods folder in which to store all the project’s dependencies.