iOS 遠程資源加載:SVNetworking

byb1234 9年前發布 | 14K 次閱讀 iOS開發 移動開發 SVNetworking

SVNetworking 是一個 iOS 上用于加載遠程資源的開發包,使用 key-value 觀察方式進行設計。

SVNetworking


SVNetworking is a library for networking and resource loading in iOS applications. It is primarily designed for use with key-value observing, and attempts to make use of functional concepts when possible. To aid in this, implementations of property binding and some higher-order functions are included.

Requests

Requests are handled by a subclasses ofSVRequest. These are fairly simple classes - SVNetworking is generally lightweight, and tries to solve most problems while maintaining elegance, instead of solving all possible problems.

SVRequestuses delegation instead of completion/failure blocks - while this often results in slightly more code, it avoids retain cycles, "weakSelf", and nested "callback hell".

While the request classes were originally the entirety of SVNetworking, the focus of the library is now on resource loading.

Remote Resources

The abstract classSVRemoteResourceprovides a base for implementations of resources that are loaded asynchronously.SVRemoteResourcehas no coupling withSVRequestor network requests in general (although some subclasses do) - it can be easily used with any other networking library, or with any other asynchronous process with an end result. For example:

  • Loading large files from disk
  • Procedural generation
  • Video processing

Resources are generally uniqued for memory benefits (among others), but this is optional.

Remote resources are intended for use with key-value observing. The binding categories onNSObjectand theSV_KEYPATHmacro are intended to aid in this.

項目主頁:http://www.baiduhome.net/lib/view/home/1429106997346

 本文由用戶 byb1234 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!