Simply speaking i'm attempting to download an image on a server using AlamofireImage
and it appears that the DataRequest extension responsible for this returns the content on the main thread.
This is problematic because it does inevitably lock the UI while it continues to process.
See the attached image, the breakpoint halts the execution of the main thread (on the left)
How can I migrate this DataRequest to use an OperationQueue that's not main?
I added an optional queue parameter to the responseImage function so that an arbitrary DispatchQueue
could be used to run completionHandler
on.
Here is the fork:
pod 'AlamofireImage', :git => 'https://github.com/timaktimak/AlamofireImage.git', :branch => 'master'
Edit: it was merged in, so AlamofireImage now has the functionality of calling the completion block on a custom DispatchQueue
.
Hope it helps!