I'm trying to use core data to indicate the date and time, but I'm getting an error.
do {
let out = try context.fetch(name)
for data in out as! [NSManagedObject] {
//Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
let day = data.value(forKey: "day") as! String
let time = data.value(forKey: "time") as! String
let id = data.value(forKey: "id") as! String
let title = data.value(forKey: "title") as! String
self.datas.append(MainViewModel(id: id, day: day, title: title, time: time))
}
}
catch {
print(error.localizedDescription)
}
}