Skip to content

Instantly share code, notes, and snippets.

@JonathanPorta
Last active August 29, 2015 14:07
Show Gist options
  • Save JonathanPorta/e1adc7962504d3f965a6 to your computer and use it in GitHub Desktop.
Save JonathanPorta/e1adc7962504d3f965a6 to your computer and use it in GitHub Desktop.
Swift Net custom headers usage example
init(hostname: String, accessToken: String) {
self.hostname = hostname
self.request = Net(baseUrlString: self.hostname, headers: ["access_token": accessToken])
}
func getActivities(callback: Callback) -> Void {
self.request.GET("/activities.json", params: nil, successHandler: { responseData in
var json = JSON(data: responseData.data)
callback(json)
}, failureHandler: { error in
NSLog("Error")
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment