This tutorial explains how to add library framework from Github.
Imagine you refer to this page that having list of frameworks, and you would like to install one of the library, such as SwiftHTTP.
Step 1:
Go to the root folder of your application.
Run git submodule add <Github URL>
E.g. git submodule add https://github.com/daltoniam/SwiftHTTP
Step 2:
Open SwiftHTTP folder under the root folder of your application.
Drag SwiftHTTP.xcodeproj to your XCode Project.
Refer to below picture, drag SwiftHTTP.xcodeproj to Chats, the top level hierarchy of project.
Step 3:
Click on SwiftHTTP.xcodeproj that added to your project hierarchy.
Check Deployment Target under General Tab.
Make sure it is the same with your application’s deployment target.
Step 4:
Click on your main application, under Build Phases Tab, click “+” under target dependencies section.
The end result is something like this.
Step 5:
Add a new phase by clicking “+” under Build Phases Tab, and choose “New Copy File Phase”, change the name to “Copy Frameworks”.
Step 6:
Under the new phase “Copy Frameworks” added in last step, destination choose “Framework”, and add the frameworks.
The end result something like this
Then test your code with the library:
var request = HTTPTask()
var params = ["k": "q:name=currency,stat=swift", "api" : "1", "server_host" : "swift"]
request.requestSerializer.headers["X-Mashape-Key"] = "Ri4j5gX4ORmshweHbjBSUUMevXWIp1i0xRujsnjCz7wW9w5zLB"
request.GET("https://imgshow-platform.p.mashape.com/", parameters: params, success: {(response: HTTPResponse) in
if let data = response.responseObject as? NSData {
let str = NSString(data: data, encoding: NSUTF8StringEncoding)
println("response: \(str)") //prints the HTML of the page
}
},failure: {(error: NSError, response: HTTPResponse?) in
println("error: \(error)")
})