So I am trying to concatenate two transform animations in swift 3. One is scale which will scale, and one is translate which will translate. I am trying to combine these two animations. I have an outlet named ourView
which is a UIView
. From my understanding I am doing everything right but it gives me this error
Value of tuple type ‘()’ has no member ‘concatenating’
Here is the code
UIView.animate(withDuration: 0.5, animations: {
let scale = self.ourView.transform = CGAffineTransform(scaleX: 1.5, y: 1.5)
let translate = self.ourView.transform = CGAffineTransform(translationX: 0, y: 50)
self.ourView.transform = scale.concatenating(translate)
})
What am I doing wrong? Does anybody have any ideas?
You are assigning a scale transform to ourView
's transform, then assigning that assignment to the scale variable. Since that assignment is a statement which doesn't take any arguments and doesn't return anything, the type of scale
is ()
. Remove the self.ourView.transform
stuff and you will be good to go.
let scale = CGAffineTransform(scaleX: 1.5, y: 1.5)
let translate = CGAffineTransform(translationX: 0, y: 50)
self.ourView.transform = scale.concatenating(translate)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With