Swift Alamofire VS AFNetworking

不问归期 提交于 2019-11-28 21:59:09

问题


I am developing an app using Swift. I want to call a REST API. I found there are two popular libraries, AFNetworking and Alamofire. But I don't know which is better (is more popular or has more features).

Can anybody suggest what are the main differences between Alamofire and AFNetworking?


回答1:


Use AFNetworking if you use Objective-C

Use Alamofire if you use Swift




回答2:


AFNetworking and Alamofire are by the same people (the Alamofire Software Foundation), Alamofire is their Swift version whereas AFNetworking is the Objective-C version.

Feature wise they are the same.




回答3:


If you are developing app using Objective-C then you must go with the AFNetworking.

Other wise if you are developing with the Swift then try the latest release of Alamofire.

In both the libraries Networking is done asynchronously. Only difference is Alamofire is no longer supported on iOS 7 due to the lack of support for frameworks.




回答4:


AFNetworking:

  • This is the objective -C version of the library.
  • This is very powerful and you could install this in your Swift project and use it as a bridge to the swift project.

Alamofire:

  • This is the Swift version of AFNetworking.
  • But not all the features of AFNetworking are included.

If you are good at Objective-C use AFNetworking. If not, use Alamofire. It is simple and many resources are available for Swift.




回答5:


AFNetworking is an Objective-C networking library for iOS, macOS and tvOS. It is a robust library that has been around for many years. From basic networking to advanced features such as Network Reachability and SSL Pinning, AFNetworking has it all. It is one of the most popular iOS libraries of all time with almost 50 million downloads.

Alamofire is AFNetworking’s successor but is written in Swift. The two libraries share a similar feature set, with the main difference being the language in which they are written.

If you are starting a brand new Swift project, my recommendation is to use Alamofire so that your core networking library is consistent with your own source code. Otherwise, both AFNetworking and Alamofire are great options.

Source : Raywenderlich



来源:https://stackoverflow.com/questions/32988412/swift-alamofire-vs-afnetworking

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!