Alamofire installation in XCODE
Alamofire installation in XCODE
Follow the steps to install a pod:
1. Open the terminal
2. command “cd” and give the path of your project and then press “Enter” key
3. Create a pod file in your project by terminal by command “touch Podfile” and press “Enter”
Note : (Name should be “pod file”)
4. Then, open “Podfile” by terminal command “open Podfile” and press “Enter”
Pod file look like following screenshot :
5. Add this following line into the pod file :
pod ‘Alamofire’
6. Once you complete this process then come to the terminal again and type command “Pod install” and then press “Enter” Key.
Once, you have entered this command, you will find below code in your terminal window.
It will install Alamofire in your project. Now, you can use it easily.
After that, you have to import Alamofire using
import Alamofire
Example :
Alamofire.request(URL, method: .get, encoding: URLEncoding.httpBody)
.responseJSON { response in
switch response.result {
case .success:
Break
case .failure(let encodingError):
break
}
}
Comments
Post a Comment