-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented data download callback #773
Conversation
Sources/ImageDownloader.swift
Outdated
@@ -141,6 +153,9 @@ extension ImageDownloaderDelegate { | |||
public func isValidStatusCode(_ code: Int, for downloader: ImageDownloader) -> Bool { | |||
return (200..<400).contains(code) | |||
} | |||
public func imageDownloader(_ downloader: ImageDownloader, didDownload data: Data, for url: URL) -> Data? { | |||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should just return the original data instead of nil
? Any reason to return a nil
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, there's no particular reason, to return nil. I've pushed updated version.
@Ashok28 Thanks for the commit. It could be useful and please take a look at the review comment above. Thank you! |
And I guess it would be better to interrupt the process and call completion handler with an error if @Ashok28 How do you think about that? Anyway, I will merge this for now and do some improvement based on it. Thanks! |
Definitely, this should have acted just as basic implementation, which I used for one specific use case, wasn't sure, if it's going to get merged. I can further improve it. |
Implemented data download callback
This adds possibility to further manipulate downloaded raw image data. Can be used i.e. for decrypting images.