ReactiveCocoaLayout
ReactiveCocoaLayout copied to clipboard
Automatically enable layer-backing during an animation
Animations are noticeably smoother when a view is layer-backed.
RCL could automatically enable layer-backing on NSView
s when any property managed by the framework (like rcl_frame
) is animated as part of a signal chain, and then disable layer-backing for all such views once the animation completes.
I have a small concern with this. If this was done with views containing text fields, they would change their appearance slightly during the transition, especially on 10.7. Will this be an option, or will it be enforced?
It could be a variation of the -animate…
methods, maybe. But it's also worth noting that animations are generally smooth enough to where any small visual differences would go unnoticed, while a choppy animation is quite noticeable.
For implementation: it looks like a call to -display
is necessary immediately after enabling wantsLayer
if you want the animation to begin immediately afterward (and not after one run loop iteration).
Yup, that is correct. I think we've all come across the email thread from @joshaber.
@alanjrogers That's actually not what the @joshaber of old recommended, but what we do in GHfM today. I can only assume he recognized the error of his ways.
ah I was thinking of a SO question answered by @joshaber . Although I can't find it now :(
Something to consider is that in OSX 10.9, NSViews will be layer backed by default just like their iOS counterparts. (normally I'd post a source link here, but I can't find one at the moment. So take this comment as apocryphal, I suppose.)
@zakdances As much as I wish that were the case, that's simply not true. That would break far too many apps to be viable. They did make layer-backed improvements under 10.9, but it's not the default.