Created
May 24, 2017 04:40
-
-
Save trilliwon/3ea8fe7b617137dda55aae7c71304f15 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class FadeInOutUnwind: UIStoryboardSegue { | |
override func perform() { | |
let sourceView: UIView = self.source.view as UIView! | |
let destinationView: UIView = self.destination.view as UIView! | |
sourceView.alpha = 1.0 | |
destinationView.alpha = 0.0 | |
let window = UIApplication.shared.keyWindow | |
window?.insertSubview(destinationView, aboveSubview: sourceView) | |
UIView.animate(withDuration: 0.2, animations: { () -> Void in | |
self.source.navigationController?.view.alpha = 0.0 | |
sourceView.alpha = 0.0 | |
destinationView.alpha = 1.0 | |
self.source.navigationController?.view.alpha = 0.0 | |
}, completion: { (_) -> Void in | |
self.source.dismiss(animated: false, completion: nil) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment