I have a view controller which I made through coding rather than storyboard to display a video. once the video has finished playing I cannot get the view controller to return to the previous one. I have a button which takes the user to the video but when the video finish it doesn't go back to the previous view controller.
import AVKit
import AVFoundation
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let player = AVPlayer(url: URL(fileURLWithPath: Bundle.main.path(forResource: "tour", ofType: "mov")!))
let vc = AVPlayerViewController()
vc.player = player
present(vc, animated: true)
}
}
this is my code for my video. I have done everything else to build the app on my storyboard