URL of screen recording from ReplayKit

I like to get the url of the ReplayKit screen recording instead of saving the video to my camera roll or forwarding it. From a WWDC 2017 video, it was mentioned that to get the url, one can use the following function:

func stopRecording(withOutput url: URL, completionHandler: ((Error?) -> Void)? = nil){}

But I am having a hard time figuring out how to call/implement this line of code. I have a start recording @IBAction button and a stop recording @IBAction button. The screen recording is working fine. However, can someone show me how or/and where to add this stopRecording function so I can get the url for the screen recording? Appreciate any help pointing me to the right direction. I am still learning Xcode. Thank-you!



    @IBAction func StartScreenRec( sender: Any) {
        screenrecorder.startRecording { (error) in
            if let error = error {
                print(error)
            }
            self.ScreenStartRecordBtn.isHidden = true
            self.StopScreenRecBtn.isHidden = false
        }
    }

    

    @IBAction func StopScreenRec(
sender: Any) {
        screenrecorder.stopRecording { (previewVC, error) in
            if let previewVC = previewVC {
                previewVC.modalPresentationStyle = .fullScreen
                previewVC.previewControllerDelegate = self
                self.present(previewVC, animated: true, completion: nil)
            }

            if let error = error {
                print(error)
            }

            self.ScreenStartRecordBtn.isHidden = false
            self.StopScreenRecBtn.isHidden = true
        }
    }