title: How to load a view before pushing it in SWIFT?
body: <p>I have a table view controller, when I press a cell, I load some data before displaying the view. When data are loaded, I push the view.</p>
  
  <pre><code>override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
  
    var post : Post = posts[indexPath.row] as Post
    self.selectedPost = post
  
    var alert:UIAlertController = ISAMContext.sharedInstance.alertDownloadInProgress("DOWNLOADING", sender:self)
  
     let request:NSURLRequest=NSURLRequest(URL:imageUrl)
  
     NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue(), completionHandler: {(response: NSURLResponse!,data: NSData!,error: NSError!) -&gt; Void in
              if error == nil {
  
                  self.comments=self.api.getCommentsData(post)
  
                  dispatch_async(dispatch_get_main_queue(), {
                      if let cellToUpdate = tableView.cellForRowAtIndexPath(indexPath) {
                          alert.dismissViewControllerAnimated(true, completion: {
                              self.performSegueWithIdentifier("postview", sender: self)
                          })
                      }
                  })
              }
  }
  
  
  override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
  
      if segue.identifier == "postview" {
          if let indexPath = self.tableView.indexPathForSelectedRow() {
              let destination = (segue.destinationViewController as UINavigationController).topViewController as PostViewController
  
              destination.post=selectedPost!
              destination.comments=comments!
              destination.delegate=self   
          }
      }
  }
  </code></pre>
  
  <p>I have some troubles with the height of an UITextView. I would like adjust the height depending on the length of the string (see my other question: <a href="https://stackoverflow.com/questions/29431968/how-to-adjust-the-height-of-a-textview-to-his-content-in-swift">How to adjust the height of a textview to his content in SWIFT?</a>)</p>
  
  <p>I found a way, calling sizeThatFits in viewDidAppear:</p>
  
  <pre><code>override func viewDidAppear(animated: Bool) {
  
      let contentSize = postTextView.sizeThatFits(postTextView.bounds.size)
      var frame = postTextView.frame
      frame.size.height = contentSize.height
      postTextView.frame = frame
  }
  </code></pre>
  
  <p>It works, but as I call my code in viewDidAppear, I can see the view appears THEN the height of textView is updated.</p>
  
  <ol>
  <li>Press on a cell</li>
  <li>Load data</li>
  <li>Push the view</li>
  <li>Display the view</li>
  <li>THEN adjust the height of the textview -> I can see the height change</li>
  </ol>
  
  <p>So my question is : It's possible to completely load a view (content and <strong>display</strong>) before pushing it ?</p>