Skip to content
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

Add a method to enqueue multiple image downloads. #51

Closed
wants to merge 2 commits into from
Closed

Add a method to enqueue multiple image downloads. #51

wants to merge 2 commits into from

Conversation

SlaunchaMan
Copy link
Contributor

We often like to pre-populate image caches so that images are already downloaded when the user gets to a part of our apps. This PR adds a method to do that to the ImageDownloader class.

{
var receipts: [RequestReceipt] = []

for request in URLRequests {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be done far shorter with flatMap

return URLRequests.flatMap {
  downloadImage(URLRequest: $0, filter: filter, completion: completion)
}

@SlaunchaMan
Copy link
Contributor Author

@kylef: Good call!

@cnoon cnoon added this to the 2.2.0 milestone Nov 22, 2015
@cnoon cnoon self-assigned this Nov 22, 2015
@cnoon
Copy link
Member

cnoon commented Nov 22, 2015

Thanks for this @SlaunchaMan! I've merged a slightly modified version of your PR in 50e2725 still giving you attribution. We'll probably release this as part of the many features going out in 2.2.0. Thanks again! 🍻

@cnoon cnoon closed this Nov 22, 2015
@kcharwood
Copy link
Contributor

This is nice. I'll pull this into a future version of AFNetworking.

@SlaunchaMan
Copy link
Contributor Author

👍

@SlaunchaMan SlaunchaMan deleted the precache-image-url-array branch July 11, 2017 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants