RunLoop.main or DispatchQueue.main when using Combine scheduler?

Sorry to resurrect an old thread, but I want to point out a problem with the following claim:

There's a big difference: RunLoop, as a Scheduler, schedules actions to run only in the default mode. So, for example, if you're using Combine to load images in the background, and then you receive(on: RunLoop.main) to stuff them into table view cells, you're going to discover that your images don't appear while the user is scrolling the table view.

The main RunLoop drains the main DispatchQueue in all modes the .common modes (thanks @eskimo), which include the tracking modes. So a Combine pipeline that uses receive(on: DispatchQueue.main) will continue to emit signals during user interactions.

(Confidential to Apple-jacks: FB7656836)

22 Likes