Skip to content

Instantly share code, notes, and snippets.

@dmytro-anokhin
Created November 19, 2019 04:33
Show Gist options
  • Save dmytro-anokhin/0d262d1d19cb7c72e5095206abcdf583 to your computer and use it in GitHub Desktop.
Save dmytro-anokhin/0d262d1d19cb7c72e5095206abcdf583 to your computer and use it in GitHub Desktop.
let imageDecoder = ImageDecoder()
var imageData = Data()
func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {
imageData.append(data)
imageDecoder.setData(imageData, allDataReceived: false)
}
func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
imageDecoder.setData(imageData, allDataReceived: true)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment