title: Swift/iOS Subview Not Showing Immediately, on Main Thread
body: <p>So I'm adding several subviews to my ViewController's view in a loop; the problem is there's a ~5s delay for it in showing up from the time I add the subview. <strong>I made sure to call setNeedsDisplay</strong> on both the subview and my view after adding it, no dice. I even double-checked that the <strong>code <em>is</em> executing on the main thread</strong> using <code>NSThread.isMainThread()</code>, and it returned true as expected. Here's my exact code:</p>
  
  <pre><code>    dispatch_async(dispatch_get_main_queue()) {
          var nib = UINib(nibName: "ProfileCard", bundle: NSBundle.mainBundle())
          var profiles = self.delegate.user!.profilesToShow
  
          //loop to add ProfileCard subviews
          while profiles.count &gt; 0 &amp;&amp; self.deck.count &lt; self.MAX_DECK_SIZE {
              println("Adding Card")
  
              //setup subview
              var card = nib.instantiateWithOwner(self, options: nil).first! as ProfileCard
              card.delegate = self
              card.frame = CGRect(x: (self.view.bounds.width - 300)/2, y: 100, width: 300, height: 200)
              card.displayProfile(profiles.first!)
  
              //add subview
              self.view.addSubview(card)
              self.view.sendSubviewToBack(card)
              card.setNeedsDisplay()
              self.view.setNeedsDisplay()
  
              //add card to deck, mark as shown
              self.deck.append(card)
              profiles.removeAtIndex(0)
          }
      }
  </code></pre>
  
  <p>Any print statements in this loop run about ~5s prior to the subview actually displaying, and I'm not sure what that's due to. I even set print statements in the init method of the subview, and even those printed with expected. </p>