I have IOS projets, it work but suddenly crash and throw error like "Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value" Why?
import Foundation
import AVFoundation
struct Video : Identifiable {
var id = UUID()
var player : AVPlayer
var user: User
}
struct User: Identifiable {
var id = UUID()
let userName: String
let userImage: String
}
struct MockData {
let videos: [Video] = [
Video(player: AVPlayer(url: URL(fileURLWithPath: Bundle.main.path(forResource: "reel_1", ofType: "mp4")!)),
user: User(userName: "cristiano", userImage: "user_9")),
Video(player: AVPlayer(url: URL(fileURLWithPath: Bundle.main.path(forResource: "reel_2", ofType: "mp4")!)),
user: User(userName: "mann_daar", userImage: "user_3")),
]
}