4

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.

  • 1
    does not a problem choice is urs, use NSURLSession or alamofire, but alamofire or afnetworking are also using same NSUrlsession, only one advantage is code is optimized and reusability – Anbu.Karthik Mar 04 '17 at 03:51

2 Answers2

4

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?

Community
  • 1
  • 1
Gourav Joshi
  • 2,419
  • 2
  • 27
  • 45
3

For Swift 3.0 Alamofire is best because it is well Optimized and also reusable and it has also many Build in features.

If You are using Objective- C then you can use AFNetworking.

AFNetworking and Alamofire are from same Developers but in Different Languages.

Gurinder Batth
  • 655
  • 9
  • 18