I am trying to implement a custom segue animation like this
https://www.dropbox.com/s/ptyn84g7fdbthcc/video-1449571130.mp4.mp4?dl=0
right now I am using this code
ViewController.swift
@IBAction func loginScreen(sender: UIButton)
{
self.performSegueWithIdentifier("customSegue", sender: self)
}
CustomSegue.swift
override func perform()
{
let sourceVC = self.sourceViewController
let destinationVC = self.destinationViewController
sourceVC.view.addSubview(destinationVC.view)
destinationVC.view.transform = CGAffineTransformMakeScale(0.05, 0.05)
UIView.animateWithDuration(0.5, delay: 0.0, options: .CurveEaseInOut, animations: { () -> Void in
destinationVC.view.transform = CGAffineTransformMakeScale(1.0, 1.0)
}) { (finished) -> Void in
destinationVC.view.removeFromSuperview()
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(0.001 * Double(NSEC_PER_SEC)))
dispatch_after(time, dispatch_get_main_queue()) {
sourceVC.presentViewController(destinationVC, animated: false, completion: nil)
}
}
}
They are two problems here. first is
obviously this code is not near to the animation like the video I share. I don't know what animation properties should I set to replicate the animation exactly like the video
second problem is
At the end of my segue, the screen flickers as if there is a delay between destination.removeFromSuperview() and source.present...