I want to change the view with a custom transition. It's working but the backgroud is dark/black so it's looking kinda wierd.
I tried to add
self.window!.backgroundColor = UIColor.white
to the delegate but that doesn't solve the problem.
Here's my code of the transition
let homeView = self.storyboard?.instantiateViewController(withIdentifier: "ViewController") as! ViewController
let transition = CATransition()
transition.duration = 2.3
transition.type = CATransitionType.reveal
transition.subtype = CATransitionSubtype.fromLeft
view.window!.layer.add(transition, forKey: "transition")
self.dismiss(animated: false, completion: nil)
present(homeView, animated: false, completion: nil)
To change the background color during transitions, it is either the window itself:
UIApplication.shared.keyWindow?.backgroundColor = UIColor.white
the root view controller:
if let root = UIApplication.shared.keyWindow?.rootViewController as? YourRootViewController {
root.view.backgroundColor = UIColor.black
}
the presenting view controller or the transition's container view.