I know the UI needs to be updated on the main thread.
I would simply like to understand what's going on behind the scenes that accounts for incredibly long delays in code that attempts to update the UI from a background thread.
Let's say your app's initial setup in terms of database calls is complete and your UITableView
datasource array is fully populated. All view controllers and their subviews have been fully rendered. Your code is doing nothing but waiting for a user action. For good measure, you wait 30 seconds longer than you think is necessary in order to make sure of this.
You then do some user action that triggers a line of code that tries updating the UI on a background thread. The result is a full 2 or 3 second delay before the UI gets updated.
If a background thread amounts to a extra processor running in parallel with a main processor, and if that extra processor has exactly zero other code to run, what on earth is it doing for two full seconds, which is an eternity for executing a single line of code?