Search code examples
iossdwebimage

Thread of SDWebImage's sd_setImage


What is the thread of the completion block of SDWebImage's sd_setImage?

If I modify the UI from the completion block, should I always wrap that code inside a DispatchQueue.main.async() {}?


Solution

  • You don't need to use DispatchQueue.main.async() {}, the completion block is always called on the main thread. The parts source code of sd_setImage method: enter image description here