Open xezero opened 9 years ago
PromiseKit 2.0 also notably brings the idea of canceling a promise! Seems like it could be useful for SGImageCache if one wants to cancel an image request entirely!? :) A good example would be if we know we're not going to need to retrieve those images anymore, we can free up the slow queue from having to fetch them at some point, since right now the only way to free up the fast queue is to move images to the slow queue.
The problem here is that PromiseKit 2.0 only works with deployment targets of iOS 8 and higher because it's written in swift, and cocoa pods can only include swift frameworks with iOS 8 targets.
I think this might mean dropping iOS 7 support unless we can figure out a way around that - which would be less than ideal.
So I had a play around and almost had a way to have an iOS7 only subspec but there's another difficult problem where PMKPromise
is objc_subclassing_restricted
in PromiseKit 2.0.
SGImageCache is currently relying on being able to subclass that object for the onRetry
and onFail
blocks.
Maybe if there's a way to implement those using vanilla PMKPromise
objects we could make the jump to 2.0.
Hm, my first thought would be to add some category methods and associated objects for the PMKPromise class? A less simplistic (but fun!) alternative could be adding some methods at runtime via class_addMethod.
Well if there's any way to get a PMKPromise to fire a .then
or similar call multiple times then we could fire those onRetry
and onFail
blocks a different way.
I'm not aware of any way to do that, but I'm also admittedly not overly familiar with advanced promise kit usage. It'd be fantastic if anybody knows a way to do that.
Error when trying to pod 'PromiseKit', "~> 2.0"