Search code examples
iosrestafnetworkingnsurlsession

Which is easy to use Afnetworking/Nsurlsession/Alamofire


I want to make rest API call. I m confused to use Afnetworking or NSurlsession or Alamofire with SWIFT 3.0. Can anyone suggest me to use which one?


Solution

  • NSURLSession is newer than NSURLConnection, if you are using swift language then you can use your own custom methods by using NSURLSession or you can use Alamofire.

    The NSURLConnection used in AFNetworking frameworks, If you are using objective - c then you can use it, that means not that you cannot use NSURLSession.

    NSURLSession launch after iOS 7.0 or 8.0. It is more efficient that NSURLConnection.

    At last, If you want to make your own custom API framework then you can use NSURLSession(for swift)(I also used this).

    If you don't required the custom framework then use Alamofire Framework.

    For more details you can refer this link:

    What are the difference among NSURLConnection, NSURLSession and AFNetworking?