title: What's causing this? - "CoreAnimation: warning, deleted thread with uncommitted CATransaction"
body: <p>Xcode 8.2.1 / macOS 10.12.4 beta</p>
  
  <p>I'm trying to understand an error I'm getting:</p>
  
  <pre><code>CoreAnimation: warning, deleted thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment to log backtraces, or set CA_ASSERT_MAIN_THREAD_TRANSACTIONS=1 to abort when an implicit transaction isn't created on a main thread.
  </code></pre>
  
  <p>I have a block of code in a swift file that sends a network request, retrieves some data and processes it before posting a notification:</p>
  
  <pre><code>// global variable
  var data: [String: Any] = [:]
  
  func requestData() {
      ...
      do {
          // process data              
          data = processedData                        
          NotificationCenter.default.post(name: didProcessData, object: nil)
          }
      } catch {
          ...
      }
  </code></pre>
  
  <p>In my main ViewController.swift file, an observer listens for the notification and updates the view.</p>
  
  <pre><code>func updateView() {
      // update the view
      textField.stringValue = "..."
  }
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      NotificationCenter.default.addObserver(self, selector: #selector(updateView), name: didProcessData, object: nil)
  
  }
  </code></pre>
  
  <p>When <code>updateView()</code> is called, the actual text fields and such take a random amount of time to actually update, and the aforementioned error appears.</p>
  
  <p>My guess was that there was an issue with thread safety, so I changed <code>updateView()</code> like so:</p>
  
  <pre><code>func updateView() {
      DispatchQueue.main.async(execute: {
          // update the view
          self.textField.stringValue = "..."
      })
  }
  </code></pre>
  
  <p>And now the view updates properly. But I'm still relatively inexperienced with programming, and I don't quite understand what exactly is causing the error.</p>