Use the alamofire in swift first install the pod file in your project using below steps:
1- open the terminal and run following commands
sudo gem update --system
sudo gem install cocoapods
pod setup
change folder to the current proejct directory
pod init
open -a Xcode Podfile
write these line your pod file
platform :ios, "8.0"
use_frameworks!
pod 'Alamofire'
pod 'SwiftyJSON'
end
target 'reqeustProject' do
end
target 'reqeustProject' do
end
import SwiftyJSON
import Alamofire
Alamofire.request(.GET, "http://api.androidhive.info/contacts/").response { (req, res, data, error) -> Void in
print("my respose data\(res)")
let outputString = NSString(data: data!, encoding:NSUTF8StringEncoding)
print("converted Data\(outputString)")
}
0 Comment(s)