Q:

UITableViewCell has inconsistent UIView animation during reveal

I have a Swift 2.0(and auto layout) based project that I am working on. I am trying to build a view controller with a simple expander control. The user clicks on the header bit and it exapnds to reveal a table of choices. 
It works, but there is a slight oddity on the initial reveal. The first time a user clicks on the header it exapnds as expected but the table contents slide in from the left ever so slightly. On subsequent clicks it exapands without this extra bit of animation.
I would like to eliminate this slight "slide in" if I could. However I am new enough to this that I don't completely understand what I am doing wrong. Searching Google and SO has proven frustrating. I don't think I know the correct terminology to explain what it is that is happening.
I've included sample code that illustrates what I am doing. I have also included an animation so you can see what it is that is happening. Thanks!
Code:
import UIKit

class ViewController: UIViewController, UITableViewDataSource {
    @IBOutlet weak var tableViewHeight: NSLayoutConstraint!

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        tableViewHeight.constant = 0
    }

    @IBAction func openTable(sender: AnyObject) {
        if tableViewHeight.constant == 0 {
            tableViewHeight.constant = 220
        } else {
            tableViewHeight.constant = 0
        }

        UIView.animateWithDuration(0.3, animations: {
            self.view.layoutIfNeeded()
        })
    }

    // MARK: tableView stuff
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 3 }

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = UITableViewCell()
        cell.textLabel?.text = "Cell \(indexPath.item)"
        return cell
    }

}

Image:

A:

You should try this for making the cells layout before display and avoid that weird effect.
    func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
      let cell = // get your cell for indexPath here
      cell.layoutIfNeeded()
    }

