title: Swift: dispatch_async is effect is inconsistent for animation
body: <p>I have a globalstate in my app. Depending on the state the GUI is different.</p>
  
  <p>When I go from the start View A to View B I have globalstate <em>3</em>
  It should show an information screen, but it doesn't. BUT: When the View B has loaded only once and I jump from View C/D/E back to View B, then the code work perfectly. (You have to be in View A to get in View B.)</p>
  
  <p>I use a lot dispatch_async(dispatch_get_main_queue.. that isn't good style, is it? </p>
  
  <p>Why is my animation not loading at the beginning? What is good style? Thank you for answers and sorry for mistakes (english isn't my mothertongue)</p>
  
  <pre><code>  override func viewDidLoad() {
      super.viewDidLoad()
  
      dispatch_async(dispatch_get_main_queue(), {
  
          self.animateTheInformationViewWhenGlobalStateIsThree()
      })
  
    }
  
  
  func animateTheInformationViewWhenGlobalStateIsThree() {
  
      print("GLOGBALSTATE \(globalState)") //it is 3
  
  
      if globalState == 3 {
  
          setGlobalState(3)
  
          dispatch_async(dispatch_get_main_queue(), {
              GUITools.animateTheInformationView(self.tableView, animateBottomLayout: self.animationBottomConstraint, value: self.negativValue)
          })
  
          print("THE POSITIV VALUE THE NEGATIV")
      }
  </code></pre>
  
  <p>//GUITools-Static-Class: </p>
  
  <pre><code>class func animateTheInformationView(tableView: UITableView, animateBottomLayout: NSLayoutConstraint, value: CGFloat) {
  
  
      dispatch_async(dispatch_get_main_queue(), {
  
      animateBottomLayout.constant += value
  
  
          UIView.animateWithDuration(Constants.animationTime, animations: { () -&gt; Void in
  
              tableView.layoutIfNeeded()
  
              },completion: {
                  (value: Bool) in
          })
  
      })
  
  }
  </code></pre>
  
  <p><strong>EDIT</strong>
  With <code>viewDidAppear</code> it works. But the animation isn't a real animation. The tableView "jumps". So there is no sliding/animation.</p>
  
  <p>I deleted all dispatch_async..</p>
  
  <p><code>override func viewDidAppear(animated: Bool) {
          self.animateTheInformationViewWhenGlobalStateIsSeven()
      }</code> </p>