Skip to content
This repository has been archived by the owner on Nov 13, 2017. It is now read-only.

Latest commit

 

History

History
46 lines (29 loc) · 1.67 KB

README.md

File metadata and controls

46 lines (29 loc) · 1.67 KB

MBTNetworking

Version License Platform

Usage

Here's an excerpt from the super-minimal example project which demonstrates instantiating the manager pointing to http://httpbin.org, performing two sequential requests to get some data, and consuming the parsed response objects:

MBTNetworkManager *manager = [[MBTNetworkManager alloc] initWithBaseURL:[NSURL URLWithString:@"http://httpbin.org"]];

[manager performRequest:[MBTSampleRequests get]].then(^(MBTHTTPBinGetModel *getModel, NSURLSessionTask *task) {
    NSLog(@"Origin: %@", getModel.origin);
    NSLog(@"User-Agent: %@", getModel.headers.userAgent);

    return [manager performRequest:[MBTSampleRequests headers]];
}).then(^(MBTHTTPBinHeadersModel *headersModel, NSURLSessionTask *task) {
    NSLog(@"Headers: %@", headersModel);
}).catch(^(NSError *error) {
    NSLog(@"Error: %@", error);
});

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

MBTNetworking requires iOS 7.0+

Installation

MBTNetworking is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "MBTNetworking"

Author

Matteo Battaglio, http://twitter.com/@m4dbat

License

MBTNetworking is available under the MIT license. See the LICENSE file for more info.