Wilson Balderrama Wilson Balderrama - 2 months ago 9
iOS Question

What's the difference between .userInitiated and .userInteractive in GCD?

I would like to know what's difference between them, I am trying to update something in the UI thus I must do it using the main thread but not sure which of them I should use to accomplish what I want.



"User initiated" means the user directly requested this operation, and is likely waiting, but the UI itself is not desperate for a result. "Fetch new tweets because the user performed pull-to-refresh" or "recalculate the tip." These things need to happen quickly, but not immediately. Once the computation is completed, you probably won't ask for it again immediately.

"User interactive" means the user is directly interacting with the result of this operation in real time. The UI needs a result right now or lagging will occur. You will probably be requesting this operation quickly and repeatedly. This is the highest priority.

For full details on these classes, see "Building Responsive and Efficient Apps with GCD."