Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIView transitionWithView swift syntax

Tags:

ios

swift

uiview

Can some help me with the syntax of the transitionWithView in swift. in objective-c I would use it like so:

[UIView transitionWithView:[ self view ] duration:0.325 options:UIViewAnimationOptionCurveEaseOut animations:
 ^{
     // do the transition
 }
 completion:
 ^( BOOL finished ){
    // cleanup after the transition
 }];

However I can not get the completion handler to work. thanks

like image 273
reza23 Avatar asked Jun 25 '14 16:06

reza23


1 Answers

it would be like this in Swift 5.x:

UIView.transition(with: self.view, duration: 0.325, options: .curveEaseInOut, animations: {

    // animation

}) { finished in

    // completion

}
like image 59
holex Avatar answered Sep 23 '22 06:09

holex