How to do UIView style animations in Cocoa/Mac app development
This should produce the same result as your iOS code:
[NSAnimationContext beginGrouping]; {
[[NSAnimationContext currentContext] setDuration:.5];
[[NSAnimationContext currentContext] setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[_myView.animator setAlphaValue:0.0];
} [NSAnimationContext endGrouping];
The default duration is .25 seconds. I'm not sure what the default timing function is. If you're ok with the defaults, you can just say this:
[_myView.animator setAlphaValue:0.0];
Update of rob mayoff answer in swift 4:
NSAnimationContext.beginGrouping()
NSAnimationContext.current.duration = 0.5
NSAnimationContext.current.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
myView.animator().alphaValue = 0
NSAnimationContext.endGrouping()