Skip to content

min/MinimalNetwork

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MinimalNetwork

MinimalNetwork is a simple HTTP library for iOS 5+. This project is still under development.

Features

  • Simple block based interface for asynchronous network requests.
  • Throttle the number of concurrent networks calls.
  • Ability to apply custom parse logic in a background thread.
  • UIImageView category to asynchronously load external images.
  • ARC enabled.

Example

HTTP GET

NSString *maybe = @"555-5555";

MN_GET(@"http://call/me/%@", maybe).
  parse((id)^(id data) {
    // background thread
    return [self customParser:data];
  }).
  success(^(MNURLRequest *request, id data) {
    [self didFinish:data];
  }).
  failure(^(MNURLRequest *request, NSError *error) {
    [self showError:error]; 
  }).
  send();
  
// or a more traditional syntax

MNURLRequest *request = [MNURLRequest get:@"http://call/me/maybe"];
request.parseBlock = (id)^(id data){
  // background thread
  return [self customParser:data];
};
request.successBlock = ^(MNURLRequest *request, id data){
  [self didFinish:data];
};
request.failureBlock = ^(MNURLRequest *request, NSError *error){
  [self showError:error]; 
};
[request start];

Images

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 48.0f, 48.0f)];
[imageView mn_load:@"http://someimage.jpg"];

About

Simple HTTP library for Objective-C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published