View Controller mit benutzerdefinierter Animation schließen?

Ich benutze diese Codezeile, um meinen View-Controller zu schließenself.dismiss(animated: true, completion: nil), aber die aktuelle Animation gefällt mir nicht. Stattdessen möchte ich von links nach rechts gleiten. Unten ist mein Versuch, eine Animation zu testen, funktioniert aber nicht.

UIView.animate(withDuration: 1.0, delay: 0.0, options: UIViewAnimationOptions.curveEaseIn, animations: {

        let transition = CATransition()
        transition.duration = 10
        transition.type = kCATransitionPush
        transition.subtype = kCATransitionFromLeft

        self.view.layer.add(transition, forKey: kCATransition)

        self.dismiss(animated: false, completion: nil)
        }, completion: nil)

Antworten auf die Frage(2)

Ihre Antwort auf die Frage