How to animate material in swift (xcode 6 beta)

I was wondering how I can animate things in the new Apple language fast.

in lens c, I would use the following code to move the image from the top of the screen to the end:

  [UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
    UIImageView.center = CGPointMake(UIImageView.center.x , UIImageView.center.y + 200);
} completion:^(BOOL finished) {
    [self move];
}]; 

so questoin:

  • How to make an animation in swift with the same effect as the code above (obj c) I would appreciate some explanation of how you can do this.
+4
source share
1 answer
UIView.animateWithDuration(1, delay: 0, options: .CurveLinear, animations: {
    UIImageView.center = CGPointMake(UIImageView.center.x, UIImageView.center.y + 200);
}, completion: {
    (finished: Bool) in
    move();
});

Here's how to do it.

+9
source

Source: https://habr.com/ru/post/1543740/


All Articles