I have an Intro video section for an app. The storyboard has a segue "toMainMenu" that links to another storyboard view controller.
The IntroVideoVC has two classes inside it:-
class IntroVideoVC: UIViewController {
    var videoView: IntroVideoView!
    override func viewDidLoad() {
        videoView = IntroVideoView(controller: self)
        self.view.addSubview(videoView)
       let tap = UITapGestureRecognizer(target: self, action: #selector(tappedVideo))
       view.addGestureRecognizer(tap)
    }
    @objc func tappedVideo() {
        videoFinished();
    }
    func videoFinished() {
        self.performSegue(withIdentifier: "toMainMenu", sender: self)
    }   
}
class IntroVideoView: UIView {
    init(controller: UIViewController) {
        super.init(frame: CGRect(x: 0, y: 0, w: 0, h: 0))
        self.controller = controller
        ...
    }
    func handleVideo(videoPlayer: AVPlayer) {
        ...
        IntroVideoVC().videoFinished()
    }
}
If i tap the video it correctly performs the segue, however if i let the video end which in-turn calls IntroVideoViews -> handleVideo() method i get a crash stating it has no segue with identifier "toMainMenu".
I think i understand why but unsure how to get around the issue being new to swift. I believe it is because handleVideo() is using IntroVideoVC as a singleton and so is losing reference to IntroVideoVC's controller! I maybe (read: likely) be wrong but that is what i feel may be causing this issue.
Just looking for a nudge in the right direction
thanks in advance
 
     
    