I am using URLSession
to download file. Two methods are there:
downloadTask(with request: URLRequest)
and
downloadTask(with url: URL).
What is difference between the two? Apart from POST, PUT, is there any special use for simple download?
The documentation on URLRequest states:
A URL load request that is independent of protocol or URL scheme.
That can be found here: URL Request Documentation
What the essentially means is that with a URL you get the iOS default behavior for all the properties of the URL and how it loads something.
With the URLRequest you get fine grained control over things like caching, protocol, cookies, and state.