What's the best approach to animate frame changes on NSView? : <p>Ideally I'd need something like <code>UIView.animateWithDuration</code>, however I know that this is not an API that's available on macOS. What's the best way to manipulate the actual frame of an NSView and animate the changes?</p>

<p>I tried going for <code>CABasicAnimation</code>, however that's performed on a CALayer rather than the view itself.</p>

<p>What I need is to animate the actual view frame... (or maybe that's a bad practice and there's an alternative?)</p>

<p>So for that reason, after a bit of digging I found <code>NSAnimationContext</code>. That however seems to simply interpolate / fade between two states which is not the feel I am going for.</p>

<p>Here's a small sample of the code I have:</p>

<pre><code>override func mouseDown(with event: NSEvent) {

    let newSize = NSMakeRect(self.frame.origin.x,
                             self.frame.origin.y - 100,
                             self.frame.width, self.frame.height + 100)

    NSAnimationContext.runAnimationGroup({ (context) -&gt; Void in
        context.duration = 0.5
        self.animator().frame = newSize
        }, completionHandler: {
            Swift.print("completed")
    })
}
</code></pre>
