CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.

ViewTransformers 1.1.0

ViewTransformers 1.1.0

Maintained by Lukas Wuerzburger.



  • By
  • Truffls GmbH

alt text

Swift Version Platform Compatibility Pod version

ViewTransformers lets you pass multiple view transformations as an array to UIView.

Install via Cocoapods

Add following to your Podfile:

use_frameworks!
pod 'ViewTransformers'

How to use

You can easily pass multiple view transformations to a UIView by using the transforms property on UIView.

view.transforms = [
    CGAffineTransform(scaleX: 0.5, y: 0.5),
    CGAffineTransform(rotationAngle: -1.42),
    CGAffineTransform(translationX: 100, y: -145)
]

Reading the transforms property only returns the merged transformations as one in a one-item-array.

Example

alt text

Used code for the example:

func playAnimation() {
    UIView.animate(withDuration: 1.0, delay: 1.0, options: .curveLinear, animations: {
        self.myView.transforms = [
            CGAffineTransform(scaleX: 0.5, y: 0.5),
            CGAffineTransform(rotationAngle: -1.42),
            CGAffineTransform(translationX: 100, y: -145)
        ]
    }, completion: { _ in
        UIView.animate(withDuration: 1.0, delay: 1.0, options: .curveLinear, animations: {
            self.myView.transforms = nil
        }, completion: { _ in
            self.playAnimation()
        })
    })
}

Contribution

Issues and pull requests are welcome!