Latest | 0.2.4 |
---|---|
Homepage | https://github.com/cmckni3/AFNetworking-PromiseKit |
License | MIT |
Platforms | ios 6.0, osx 10.7, requires ARC |
Dependencies | PromiseKit, AFNetworking |
Authors |
Wrapper for the AFHTTPRequestOperation class to return a PromiseKit promise.
Promises clean up the structure of code and provide better data flow
and error handling especially when using asynchronous methods.
Requirements
Supported Platforms
- iOS 6.0+
- OS X 10.7+
Installation
Install via CocoaPods
-
Add the library to
Podfile
platform :ios, '6.0' pod 'AFNetworking-PromiseKit'
- Install pod
pod install
Manual
- Drop
AFHTTPRequestOperation+PromiseKit.h
,AFHTTPRequestOperation+PromiseKit.m
,
andAFNetworking-PromiseKit.h
into an Xcode project with AFNetworking
and set the appropriate targets.
Usage
Import the category
-
Manual install
#import "AFNetworking-PromiseKit.h"
- CocoaPods install
#import <AFNetworking-PromiseKit/AFNetworking-PromiseKit.h>
Call a typical AFHTTPRequestOperation
operation class method and use the resulting promise.
NSMutableURLRequest *request = [[AFClient sharedClient] requestWithMethod:@"GET" path:@"/test.json" parameters:nil];
[AFJSONRequestOperation promise:request].then(^(AFHTTPRequestOperation *operation, id JSON){
NSLog(@"Received: %@", JSON);
}).catch(^(NSError *error){
NSLog(@"Received an error: %@", error);
});
License
AFNetworking-PromiseKit is licensed under the MIT license. Please see the license for more information.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Latest podspec
{ "name": "AFNetworking-PromiseKit", "version": "0.2.4", "summary": "AFNetworking category for PromiseKit", "description": " Wrapper for the AFHTTPRequestOperation class ton return a PromiseKit promise.nn Promises clean up the structure of code andn provide better data flow and error handlingn especially when using asynchronous methods.n", "homepage": "https://github.com/cmckni3/AFNetworking-PromiseKit", "license": { "type": "MIT", "file": "MIT-LICENSE" }, "authors": { "Chris McKnight": "[email protected]" }, "social_media_url": "https://twitter.com/cmckni3", "platforms": { "ios": "6.0", "osx": "10.7" }, "source": { "git": "https://github.com/cmckni3/AFNetworking-PromiseKit.git", "tag": "0.2.4" }, "source_files": "AFNetworking-PromiseKit", "requires_arc": true, "dependencies": { "PromiseKit": [ "~> 1.5" ], "AFNetworking": [ "~> 1" ] } }
Sat, 05 Mar 2016 12:00:03 +0000