title: UI (sometimes) freezes during an operation on iOS
body: <p>So, on my app I have a feed that I want to update every time the user returns to the app.
  I'm calling a routine to do this on <code>applicationWillEnterForeground</code> of my <code>AppDelegate</code>.
  Everything is working fine but, <strong>sometimes</strong>, my UI freezes during this operation.
  I was able to find where this occurs using a label to show the progress of this routine. The label is updated on three major points:</p>
  
  <ul>
  <li>Before starting the routine</li>
  <li>Inside the routine</li>
  <li>When the routine ends</li>
  </ul>
  
  <p>Sometimes, this workflow works fine, and I'm able to see the progress through this label.
  But sometimes, the label only shows the first message, and messages that happen inside the routine does not appear. Besides that, I can't do anything on my app, because the UI is frozen. Once the routine is over, everything comes back to normal.</p>
  
  <p>Here's a simplified version of the flow my app executes to call this routine:</p>
  
  <pre><code>@UIApplicationMain
  class AppDelegate: UIResponder, UIApplicationDelegate {
  
      let mainViewController = MainViewController()
  
      func applicationWillEnterForeground(_ application: UIApplication) {
          mainViewController.refreshLatestVideos()
      }
  
  }
  
  class MainViewController: UITabBarController {
  
      private var subscriptionsController: SubscriptionsController! // initialized on viewDidLoad
  
      func refreshLatestVideos() {
          subscriptionsController.refreshLatestVideos(sender: nil)
      }
  
  }
  
  class SubscriptionsController: UITableViewController {
  
      private var subscriptionsModelController: SubscriptionsModelController! // received on constructor
  
      @objc func refreshLatestVideos(sender:UIButton!) {
          showMessage(message: "Updating subscriptions...") // this message is always shown to me
          subscriptionsModelController.loadLatestVideos()
      }
  
  }
  
  class SubscriptionsModelController {
  
      func loadLatestVideos() {
          UIApplication.shared.isNetworkActivityIndicatorVisible = true
  
          DispatchQueue.global(qos: .userInitiated).async {
              // bunch of requests with Just
              ...
  
              // update message
              showMessage(message: "Updating subscription x of y") // this message sometimes doesn't appear, because the UI is frozen
  
              // another requests
              ...
  
              // update message
              showMessage(message: "Updates completed")
          }
      }
  
  }
  </code></pre>
  
  <p>As you can see, I'm executing the update inside the global queue, so I'm not blocking the main thread.
  And again, this freezing of the UI only happens sometimes.</p>
  
  <p><strong>Is there any point which I can look at to find what's going on? Is it possible that the main thread is being blocked by something else?</strong></p>