I was trying to make a video player in Xcode by following a youtube tutorial as I'm very new to coding but it keeps saying "Use of unresolved identifier: 'present'"
import UIKit
import AVKit
class VideoP: NSObject {
@IBAction func vidButton(_ sender: Any) {
if let path = Bundle.main.path(forResource: "video", ofType: "mp4")
{
let video = AVPlayer(url: URL(fileURLWithPath: path))
let videoPlayer = AVPlayerViewController()
videoPlayer.player = video
present(videoPlayer, animated: true, completion:
{
video.play()
})
}
}
}
sorry if this is a confusing question as I said I'm very new!