infinitered / redpotion

We believe iPhone development should be clean, scalable, and fast with a language that developers not only enjoy, but actively choose. With the advent of Ruby for iPhone development the RubyMotion community has combined and tested the most active and powerful gems into a single package called RedPotion
MIT License
233 stars 40 forks source link

Update to use SDWebImage #99

Closed markrickert closed 9 years ago

markrickert commented 9 years ago

Moves from JMImageCache to SDWebImage.

Note my operation storage methodology of using the instance's memory address in a var. Any thought about a better way of doing this with UIImageView when we don't necessarily know where the image view is (like in a table cell or a collection view) and we can't invalidate it in the prepareForReuse method of the cell?

jamonholmgren commented 9 years ago

Why not value.to_s?

markrickert commented 9 years ago

I figured "%p" % self runs self.inspect and would be more reliable. Do you have an idea about an alternative method, @jamonholmgren?

jamonholmgren commented 9 years ago

If it works, fine with me. Using the url of the image as the cache key kind of makes sense, though, doesn't it?

markrickert commented 9 years ago

Not really... there's an edge case where two different images request the same image almost simultaneously and it might overwrite the first operation with the new operation. I think it's safer to go based off the UIImageView requesting the image's memory address since we know there'll only be one image request per UIImageView.

markrickert commented 9 years ago

... and when that same UIImageView requests a new remote image, we cancel it's previous image operation and start the new one.

markrickert commented 9 years ago

WOOHOO! Specs passed. This is ready to go if you guys think it looks good @jamonholmgren @twerth @GantMan

jamonholmgren commented 9 years ago

:+1: :shipit:

squidpunch commented 9 years ago

:clap: