JTSImageViewController
JTSImageViewController copied to clipboard
Support for a custom downloader and delegate to provide them
Currently, image downloading within the framework is handled by two static functions on JTSSimpleImageDownloader, called from the JTSImageViewController without a means of override or customization. This PR refactors the existing downloading process to utilize two protocols:
JTSImageViewControllerDownloadDelegate- A delegate which provides instances of a downloaderJTSImageViewControllerDownloader- A downloader which handles downloading the image and provides progress updates
The changes are backwards compatible with 1.5.1, and everything continues to work exactly the same as it has out-of-the-box. This compatibility is accomplished by providing default implementations of the protocols which use the existing downloader when one is not supplied by the user. These protocols can be used to easily provide a custom downloader within the framework. For instance, in my current project I have implemented the delegate and downloader using Alamofire to call a REST API, passing custom headers for Authorization, etc., and also interfacing with a caching system that was already in use within the project.
You will likely not want to bring in the changed pod spec, for obvious reasons. Please let me know if there are any other issues with the PR.
Nice