// // ViewController.swift // import UIKit class ViewController: UIViewController { private let button: UIButton = { let button = UIButton(type: .system) button.setTitle("Click Me!", for: .normal) button.setTitleColor(.black, for: .normal) button.backgroundColor = .white button.translatesAutoresizingMaskIntoConstraints = false return button }() private var fullScreenTransitionManager: FullScreenTransitionManager? override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .systemBackground view.addSubview(button) NSLayoutConstraint.activate([ button.widthAnchor.constraint(equalToConstant: 200), button.heightAnchor.constraint(equalToConstant: 200), button.centerXAnchor.constraint(equalTo: view.centerXAnchor), button.centerYAnchor.constraint(equalTo: view.centerYAnchor) ]) button.addTarget(self, action: #selector(presentMyViewController), for: .primaryActionTriggered) } @objc private func presentMyViewController(_ button: UIButton) { let fullScreenTransitionManager = FullScreenTransitionManager(anchorView: button) let myViewController = MyViewController() myViewController.modalPresentationStyle = .custom myViewController.transitioningDelegate = fullScreenTransitionManager present(myViewController, animated: true) self.fullScreenTransitionManager = fullScreenTransitionManager } }