Skip to content
YTKNetwork is a high level request util based on AFNetworking.
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
Docs Merge pull request #339 from Huang-Libo/patch-1 Sep 5, 2017
Framework FIX: Download task exist file overwrite and cleanup if fail. Nov 3, 2016
YTKNetwork.xcodeproj MOD: separate test dir Oct 17, 2016
YTKNetworkDemo MOD: move urlString:appendParameter away from main project, fix #239 Oct 17, 2016
.travis.yml MOD: update .travis.yml & README & MigrationGuide Aug 17, 2016
Cartfile ADD: framework project & Carthage support & test cases Aug 3, 2016
LICENSE MOD: AFN-3.X Aug 3, 2016
YTKNetwork.podspec MOD: bump version to 2.0.4 Sep 5, 2017


License MIT Pod version Carthage Compatible Platform info Build Status


YTKNetwork is a high level request util based on AFNetworking. It's developed by the iOS Team of YuanTiKu. It provides a High Level API for network request.

YTKNetwork is used in all products of YuanTiKu, including: YuanTiKu, YuanSoTi, YuanFuDao, FenBiZhiBoKe.



  • Response can be cached by expiration time
  • Response can be cached by version number
  • Set common base URL and CDN URL
  • Validate JSON response
  • Resume download
  • block and delegate callback
  • Batch requests (see YTKBatchRequest)
  • Chain requests (see YTKChainRequest)
  • URL filter, replace part of URL, or append common parameter 
  • Plugin mechanism, handle request start and finish. A plugin for show "Loading" HUD is provided


YTKNetowrk is suitable for a slightly more complex project, not for a simple personal project.

YTKNetwork is helpful if you want to cache requests, manage the dependences of requests, or validate the JSON response. And if you want to cache requests based on request version, this is one of the greatest advantages of YTKNetwork.


YTKNetwork provides YTKRequest to handle every network request. You should inherit it and override some methods to define custom requests in your project.

The main idea is use the Command Pattern. The benefits are:

  • Your code is decoupled to detail network request framework, it's easy to replace it. Actually, YTKNetwork is originally based on ASIHttpRequest, we just spent two days to switch to AFNetworking.
  • Handle common logic in base class.
  • Easier Persistence

But YTKNetwork is not suitable if your project is very simple. You can use AFNetworking directly in controller.


To use YTKNetwork add the following to your Podfile

pod 'YTKNetwork'

Or add this in your Cartfile:

github "yuantiku/YTKNetwork" ~> 2.0


YTKNetwork Version AFNetworking Version Minimum iOS Target Note
2.x 3.x iOS 7 Xcode 7+ is required.
1.x 2.x iOS 6 n/a

YTKNetwork is based on AFNetworking. You can find more detail about version compability at AFNetworking README.

Guide & Demo



Thanks for their great work.  


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

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.