I am converting an Objective C app to Swift and come across an issue. Here is my Objective C code which works.
[CATransaction begin];
[CATransaction setAnimationDuration:seconds];
[CATransaction setAnimationTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]];
[[_topLabel animator] setFrameOrigin:NSMakePoint(x, y)];
[CATransaction commit];
Here is my Swift code
CATransaction.begin()
CATransaction.setAnimationDuration(seconds)
CATransaction.setAnimationTimingFunction(CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut))
self.movingLabel.setFrameOrigin(NSMakePoint(x, y))
CATransaction.commit()
My issue is the label is moved instantly instead of taking into account the duration. I have in both projects enabled the Core Animation Layer.
Am I missing anything in the Swift converted code or have set it up incorrectly ?