Multiple CGAffineTransforms in Swift 3

In Swift 2, we could do this to get the rotation and stretch:

let rotate = CGAffineTransformMakeRotation(1) let stretchAndRotate = CGAffineTransformScale(rotate, 0.8, 0.8) label.transform = stretchAndRotate 

In Swift 3, the CGAffineTransformScale became the CGAffineTransform and no longer accepts rotation.

What is the easiest way to apply stretch and rotate to an object?

Thanks,

Rob

+7
ios iphone xcode swift core-animation
source share
1 answer

In Swift 3, many of the global C functions are mapped to member functions of the appropriate type; compare โ€œImport as a memberโ€ in rapid evolution.

In your case it will be

 let rotate = CGAffineTransform(rotationAngle: 1.0) let stretchAndRotate = rotate.scaleBy(x: 0.8, y: 0.8) 
+31
source share

All Articles