Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Creator of Alamofire here. Just pushed the 1.0.0 release. Happy to answer any questions you might have.


Hey Matt! A few:

* Is this being used in any apps in the App Store currently by you? (or Panic?)

* Is Alamofire a non-profit or some kind of organization? Curious why it's listed in the README.

* Perhaps a bit deeper: Why a rewrite of AFNetworking's feature set instead of a AFN 3.0?


Looks like a great lib with a nice API, thx.

Was there any reason why you chose callbacks over a Promise-like pattern for the async responses?

Also do you know of any good HTTP Server libraries that will let you develop simple HTTP JSON services in Swift?


See Moya for a lib built on top of AlamoFire that adds reactive signals (fulfilling the promises use case): https://github.com/AshFurrow/Moya


> Was there any reason why you chose callbacks over a Promise-like pattern for the async responses?

Deeply-nested networking callbacks are a code smell, and I find that promises often do more harm by hiding those smells—or worse, obscuring the flow itself. In practice, Alamofire is mostly going to be single or at most nested two levels deep anyway.


What about supporting using something like PromiseKit for error handling and interoperability with aggregation methods? Would you be willing to consider that?

Thanks for your work by the way.


I don't really see much need for it. Others are welcome to create such an integration, but I probably won't do so myself.


Aggregation of multiple requests with centralized error handling would be really nice, I guess that could be built from the outside though.


Is there any way to add custom HTTP header yet? This would make for a nice API:

  Alamofire.request(.GET, "http://httpbin.org/get")
           .header("custom-header", "value")


The short answer: Use the version of `request` that takes a `URLRequestConvertible`, and specify the header fields in that.

The long answer: Custom headers on a per-request basis are a bit of a red herring, from an API design perspective. In reality, most use cases boil down to one of three, which are taken care of in other ways:

- Default headers, such as `User-Agent`, are specified in `NSURLSessionConfiguration -HTTPAdditionalHeaders`. - `Authorization` headers, which are handled by `NSURLCredential` and `NSURLAuthenticationChallenge`. - `Content-Type` headers, which are handled by `ParameterEncoding`.

This is why Alamofire is designed the way it is.


In the README it looks like using the ObjC AFNetworking is suggested if one wishes to do multipart http requests, I assume this is up to date and Alamofire doesn't support this at this time?


Yes, that's correct.


Awesome!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: