title: How to animate the size change of an NSViewController presented as a sheet?
body: <p>In Xcode, if you try to create a new file, it will ask you where to save it. There is this button that you can press to expand the sheet presented:</p>
  
  <p><a href="https://i.stack.imgur.com/dxV76.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dxV76.png" alt="enter image description here"></a></p>
  
  <p>I am trying to create something similar to that button, which will enlarge an <code>NSViewController</code> presented with a Sheet segue. Note that I am not trying to create my own version of <code>NSSavePanel</code>. I am just trying to use this as an example to illustrate the behaviour of the button that I want to create.</p>
  
  <p>I know that I can set the <code>preferredContentSize</code> to something bigger to enlarge the sheet:</p>
  
  <pre><code>preferredContentSize = CGSize(width: 300, height: 300)
  </code></pre>
  
  <p>But that changes the size immediately, unlike the button in the save file dialog, which shows an animation of the sheet enlarging.</p>
  
  <p>I tried putting it in an animation block:</p>
  
  <pre><code>NSAnimationContext.runAnimationGroup { (context) in
      context.duration = 1
      preferredContentSize = CGSize(width: 300, height: 300)
  }
  </code></pre>
  
  <p>But the same thing happens.</p>
  
  <p>I'm pretty sure there should be a method in <code>NSViewController</code> or something like that I am failing to find...</p>