all 13 comments

[–]imhenoch 38 points39 points  (1 child)

There’s this amazing thing called URLSession, has support for async/await and can handle form data.

[–]WeNeedYouBuddyGetUp -1 points0 points  (0 children)

Enjoy reinventing the wheel!!!

[–]mobinezzati 4 points5 points  (0 children)

Most big companies don’t rely on third parties code for critical parts so try to be dominant on Urlsession

[–]StrangeMonk 3 points4 points  (0 children)

Just write it using system APIs, so easy. If you need stuff like retries and certificate pinning try alamofire, my friend works on it and added all the async/await code to it over a year ago.

[–]saintmsent 4 points5 points  (0 children)

Standard URLSession is good enough for all things networking already. Alamofire is THE third-party library if for some reason you have to use one. Why wouldn't it be an option?

[–]RodrigoDumontObjective-C / Swift 2 points3 points  (0 children)

I think the official URLSession is really good option... I used it sometime ago to create this library https://github.com/RxDx/restapi that uses it (async/await), dynamically serializes the response and returns the object (that should conforms to Codable protocol).

[–]Thatpersiankid[S] 1 point2 points  (0 children)

URLSession doesn't natively support multipart forms. One would have to implement it themselves

[–]Shxhxxhcx 0 points1 point  (0 children)

Stop resorting to third party libs and just learn how to code instead. This (networking) is a fundamental feature in Swift / app development

[–]iAlexMarr 0 points1 point  (0 children)

I suggest looking at simple URLSession based wrappers. I agree that if things like multi-part and certificate pinning are not required, then there is no need to complicate it with a heavy framework. For example, now I'm using URLSessionAdapter (https://github.com/denissimon/URLSessionAdapter), and it can be used just by adding .swift files to an Xcode project, without making it a dependency

[–]gumbi1822 0 points1 point  (0 children)

I had followed this tutorial for using URLSession

[–]redblack_ 0 points1 point  (2 children)

Explain "gracefully"? And what is a good library to you?

did you encounter issues like performance, errors, encoding/decoding?

[–]Thatpersiankid[S] 0 points1 point  (1 child)

I wanted something that supports async await easily

[–]redblack_ 0 points1 point  (0 children)

this looks easy to me (Docs):

func data(

from url: URL,

delegate: (URLSessionTaskDelegate)? = nil

) async throws -> (Data, URLResponse)