Last active
August 29, 2015 14:07
-
-
Save JonathanPorta/e1adc7962504d3f965a6 to your computer and use it in GitHub Desktop.
Swift Net custom headers usage example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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