Skip to content
This repository has been archived by the owner on Aug 13, 2021. It is now read-only.

Commit

Permalink
Disable actions when writing to CALayer properties.
Browse files Browse the repository at this point in the history
Summary: We don't want CALayer writes to create implicit animations.

Reviewers: O2 Material Motion, O4 Material Apple platform reviewers, #material_motion, chuga

Reviewed By: O4 Material Apple platform reviewers, chuga

Tags: #material_motion

Differential Revision: http://codereview.cc/D2797
  • Loading branch information
jverkoey committed Feb 24, 2017
1 parent d458017 commit a8c9ed5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/reactivetypes/ReactiveCALayer.swift
Expand Up @@ -115,7 +115,12 @@ public class ReactiveCALayer {
fileprivate func property<T>(_ name: String, initialValue: T, externalWrite: @escaping NextChannel<T>, keyPath: String) -> ReactiveProperty<T> {
let layer = self.layer
var lastAnimationKey: String?
let property = ReactiveProperty(name, initialValue: initialValue, externalWrite: externalWrite, coreAnimation: { [weak self] event in
let property = ReactiveProperty(name, initialValue: initialValue, externalWrite: { value in
let actionsWereDisabled = CATransaction.disableActions()
CATransaction.setDisableActions(false)
externalWrite(value)
CATransaction.setDisableActions(actionsWereDisabled)
}, coreAnimation: { [weak self] event in
guard let strongSelf = self else { return }
switch event {
case .add(let animation, let key, let initialVelocity, let completionBlock):
Expand Down

0 comments on commit a8c9ed5

Please sign in to comment.