iOS12: transitionController was deprecated

May*_*sam 2 viewcontroller swift

I have a UIDocumentBrowser based app which opens a specific type of files. The default transition for opening a file is sliding from bottom, which is not the nicest transition user can expect. Before iOS 12 with this piece you could get a zoom transition, it does work now too, but the compiler is complaining about using transitionController(forDocumentURL:) which is deprecated. How can I have this effect in iOS 12 way?

func presentDocument(at documentURL: URL) {
    let storyBoard = UIStoryboard(name: "Main", bundle: nil)
    let documentViewController = storyBoard.instantiateViewController(withIdentifier: "MainViewController") as! MainViewController
    documentViewController.document = Document(fileURL: documentURL)
    // 
    documentViewController.transitioningDelegate = self
    let transitioningController = transitionController(forDocumentURL: documentURL)
    transitioningController.targetView = documentViewController.view
    self.transitioningController = transitioningController
    //
    present(documentViewController, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)

Rob*_*Rob 5

我相信参数已更改,您可以替换forDocumentURLforDocumentAt

let transitioningController = transitionController(forDocumentAt: documentURL)
Run Code Online (Sandbox Code Playgroud)