AFNContext is a Chainable, User-Friendly, Full-Featured wrapper over AFNetworking.
AFNContext
.context(nil)
.path(@"http://example.com/thing")
.success(^(id responseObject) {
// handle response
})
.failure(^(NSError *error) {
// handle error
})
.done();
AFNContext
.context(nil)
.method(@"POST")
.addParamster(@"foo", @"bar")
.path(@"http://example.com/things")
.success(^(id responseObject) {
// handle response
})
.failure(^(NSError *error) {
// handle error
})
.done();
AFNContext
.context(nil)
.method(@"POST")
.path(@"http://example.com/things")
.addMultipartFileData(imageData, @"image", @"image.png", @"image/png")
.uploadProgress(^(CGFloat progress) {
NSLog(@"upload progress: %@", @(progress));
})
.success(^(id responseObject) {
// handle response
})
.failure(^(NSError *error) {
// handle error
})
.done();
AFNContext
.context(nil)
.path(@"http://example.com/file.zip")
.downloadProgress(^(CGFloat progress) {
NSLog(@"upload progress: %@", @(progress));
})
.success(^(id responseObject) {
// handle response
})
.failure(^(NSError *error) {
// handle error
})
.done();
As AFNContext implements dot style chaining using returned blocks, Xcode does little help in code completion. Thus there are code snippets help you out.
Copy the included code snippets to ~/Library/Developer/Xcode/UserData/CodeSnippets and enjoy! :]
AFNContext is released under the MIT license.