title: Why doesn't defining my view controller size with frameOfPresentedViewInContainerView make it that size?
body: <p>I've been following <a href="https://www.shinobicontrols.com/blog/posts/2014/09/04/ios8-day-by-day-day-24-presentation-controllers">this tutorial</a> on implementing custom view controller transitions in iOS 8 with <code>UIPresentationController</code>, and so far it all makes sense, but I can't seem to get my view controller to be the right size.</p>
  
  <p>In that tutorial, they have the following code:</p>
  
  <pre><code>class OverlayPresentationController: UIPresentationController {
     let dimmingView = UIView()
  
    override init(presentedViewController: UIViewController!, presentingViewController: UIViewController!) {
      super.init(presentedViewController: presentedViewController, presentingViewController: presentingViewController)
      dimmingView.backgroundColor = UIColor(white: 0.0, alpha: 0.5)
    }
  
    override func presentationTransitionWillBegin() {
      dimmingView.frame = containerView.bounds
      dimmingView.alpha = 0.0
      containerView.insertSubview(dimmingView, atIndex: 0)
  
      presentedViewController.transitionCoordinator()?.animateAlongsideTransition({
        context in
        self.dimmingView.alpha = 1.0
      }, completion: nil)
    }
  
    override func dismissalTransitionWillBegin() {
      presentedViewController.transitionCoordinator()?.animateAlongsideTransition({
        context in
        self.dimmingView.alpha = 0.0
      }, completion: {
        context in
        self.dimmingView.removeFromSuperview()
      })
    }
  
    override func frameOfPresentedViewInContainerView() -&gt; CGRect {
      return containerView.bounds.rectByInsetting(dx: 30, dy: 30)
    }
  
    override func containerViewWillLayoutSubviews() {
      dimmingView.frame = containerView.bounds
      presentedView().frame = frameOfPresentedViewInContainerView()
    }
  }
  </code></pre>
  
  <p>I understand all of it, except for <code>frameOfPresentedViewInContainerView</code>. That returns a size, <strong>but</strong>, if I remove <code>presentedView().frame = frameOfPresentedViewInContainerView()</code> in <code>containerViewWillLayoutSubviews</code> it doesn't work. Why do I have to have that line? You would think the function itself would be sufficient, otherwise I'd just implement a random size in the <code>containerViewWillLayoutSubviews</code> method.</p>