UIView animateWithDuration in Swift 4

0

I have this code in Objective-C and I want to pass it to Swift 4.

Can someone tell me the simplest way?

I'm starting with the language and I'm a little lost, thanks.

[UIView animateWithDuration:0.25
           animations:^{
               datePicker.alpha = 0.0f;
           }
           completion:^(BOOL finished){
               datePicker.hidden = YES;
           }];
    
asked by Shadros 12.04.2018 в 08:14
source

1 answer

1

The code you attached would look like this in swift 4

 UIView.animate(withDuration: 0.25, animations: {
    datePicker.alpha = 0
 }) { (_) in
    datePicker.hidden = true
 }
    
answered by 12.04.2018 / 19:24
source