Skip to content

Instantly share code, notes, and snippets.

@lengocgiang
Created December 3, 2017 09:52
Show Gist options
  • Save lengocgiang/9a3e1003964c916a0ca7b574db0180e2 to your computer and use it in GitHub Desktop.
Save lengocgiang/9a3e1003964c916a0ca7b574db0180e2 to your computer and use it in GitHub Desktop.
addSubview and removeFromSuperview animation in Swift 4.0
# addSubview
UIView.transition(with: self.view, duration: 0.25, options: [.transitionCrossDissolve], animations: {
self.view.addSubview(view)
}, completion: nil)
# removeFromSuperview
UIView.transition(with: self.view, duration: 0.25, options: [.transitionCrossDissolve], animations: {
subview.removeFromSuperview()
}, completion: nil)
@Cornelius92
Copy link

Cornelius92 commented Nov 16, 2020

Thanks, man!

@erickbrittes
Copy link

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment