If you want to install CocoaPods for the first time for your project.
Example: Here we will install the "Alamofire" SDK using CocoaPods step by step.
Step 1. Open Terminal, hit command, and then press the Enter key
sudo gem install cocoapods
Step 2. If it asks, you should provide system password and then press the Enter key
Step 3. With command “cd” and give the path of your project and then press the Enter key
Note: type the "cd" command then space and drag the project folder to the terminal. It will take the project path as shown below (here my project name is: Simple Alamofire)
cd /Users/ramdhanchoudhary/Documents/Swift\ Workspace/Simple\
Alamofire
Step 4. Create a pod file in your project by terminal by command “touch Podfile” and press “Enter”
touch Podfile
Step 5. Then, open “Podfile” by terminal command “open Podfile” and press “Enter”
open Podfile
Step 6. Now type following code in opened pod file then save and close file
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!
target '<Your Target Name>' do
pod 'Alamofire', '~> 4.0'
end
Step 7. Back in Terminal type command “Pod install” and then press Enter Key.
Pod install
Step 8. Wait for the install to get complete 100% its around 650+ MB
Step 9. That's it goto project folder and open below file
<your project name>.xcworkspace
Step 10. Import Alamofire class and use!!
import Alamofire