Extension

CATransaction

This extension adds a handy function for turning off implicit CATransaction behaviour.

Declaration

extension CATransaction

Overview

When working with animatable layers, it is sometimes very useful to suppress the implicit 0.25s animation behaviour that comes default in Core Animation.

Topics

Disabling Implicit Animations

suppressAnimations()

static func suppressAnimations(actions: () -> Void) {
    begin()
    setAnimationDuration(0)
    actions()
    commit()
}

To use this, simply do the following:

CATransaction.suppressAnimations {
  //... all the stuff you want to not animate.
}
background Made with Flow.
underscore Made with Flow.
line2 Made with Flow.
line1 Made with Flow.
circle Made with Flow.
hit Made with Flow.

result(s) found for “”.