I have a simple Swift macOS app (using Xcode 8.2.1) that contains a single NSButton. When I click the button I would like it to fade out over a specified period. I thought I could use NSAnimationContext but no matter what value I set the context duration the button fades out almost immediately. Is this not the right way to do this?
class ViewController: NSViewController {
  @IBOutlet weak var basicButton: NSButton!
  override func viewDidLoad() {
    super.viewDidLoad()
  }
  @IBAction func basicButtonClicked(_ sender: NSButton) {
    NSAnimationContext.runAnimationGroup({ (context) in
      context.duration = 10.0
      self.basicButton.animator().alphaValue = 1
    }) { 
      self.basicButton.animator().alphaValue = 0
    }
  }
}