thiagoperes / IDMPhotoBrowser

Photo Browser / Viewer inspired by Facebook's and Tweetbot's with ARC support, swipe-to-dismiss, image progress and more
MIT License
2.71k stars 644 forks source link

Supporting SDWebImage #37

Open sibljon opened 10 years ago

sibljon commented 10 years ago

Would this project be open to supporting SDWebImage as the image cache and download engine, in addition to AFNetworking? Essentially, you could support both by breaking the URL loading and caching code into a category of IDMPhoto. Then, use cocoapods subspecs to allow developers to choose between SDWebImage and AFNetworking when installing the IDMPhotoBrowser pod. In fact, this strategy could be extended Here's what it would look like:

Install with AFNetworking: pod 'IDMPhotoBrowser/Core' pod 'IDMPhotoBrowser/AFNetworking ' # This adds IDMPhoto+AFNetworking

OR

Install with SDWebImage: pod 'IDMPhotoBrowser/Core' pod 'IDMPhotoBrowser/SDWebImage' # This adds IDMPhoto+SDWebImage

Both categories on IDMPhoto would have the same networking methods (+ (IDMPhoto *)photoWithURL:(NSURL *)url;), just different implementations.

eduardocallado commented 10 years ago

Is there any particular reason you need or want to use SDWebImage to manage image downloads? Since AFNetworking works nice.

sibljon commented 10 years ago

It's simply a choice of your image caching engine. If you're already using SDWebImage elsewhere, it makes sense to keep using it (rather than having two separate caches).

sibljon commented 10 years ago

In general, I think a positive architectural change would be to factor out all of the cocoa pods dependencies of IDMPhotoBrowser via sub specs (as mentioned above), or via delegate patterns. This is particularly important for UI elements (DACircularProgressView), for app-specific UI consistency.

kukat commented 10 years ago

+1

smn8600 commented 10 years ago

+1

sprint84 commented 10 years ago

+1 for SDWebImage

ipeisong commented 9 years ago

+1

DDany commented 9 years ago

+1

PhillipApps commented 9 years ago

+infinite

sarbogast commented 9 years ago

For me the biggest advantage is that SDWebImage supports disk caching whereas AFNetworking only supports memory caching. Concretely, that means that big images don't get cached at all and cache doesn't survive app restart.

ipeisong commented 9 years ago

maybe extract the cache interface, set default provider as AFNetworking but also allow other providers.

zhouzhui commented 9 years ago

+1

robmontesinos commented 9 years ago

I am interested. Thank you. How do you alter the podFile to implement this branch?

sprint84 commented 9 years ago

@robmontesinos here's how you tell cocoapods to go fetch a fork instead of the original project:

pod 'IDMPhotoBrowser', :git => 'https://github.com/[username]/IDMPhotoBrowser.git'

robmontesinos commented 9 years ago

Thank you @sprint84!! I had different options to go from googling. I appreciate your super quick response!!

isaced commented 9 years ago

+1 for SDWebImage

tounaobun commented 8 years ago

+1

maimake commented 8 years ago

+1

Roshanzs commented 8 years ago

+1