一个漂亮简单的Swift网络库:Rinku

jopen 10年前

一个漂亮简单的Swift网络库

允许用户通过 NSURLSession 建立与外界的连接。 同时开发它的主要目标是:

  • Minimalism
  • Composability
  • Simplicity

Usage

The most basic case would be with a GET:

Rinku.get("http://myservice.com/").completion({completion in }) 

The completion parameter is a tuple (NSData!, NSURLResponse!, NSError!). You can as well POST data:

Rinku.post("http://myservice.com/").body(image).completion({completion in }) 

Actions

The currents actions are part of this version:

  • Add an HTTP Headers
  • Add an HTTP Body
  • Add a completion block

项目主页:http://www.open-open.com/lib/view/home/1406470804337