Swift: handling an unexpected nil value, when variable is not optional [duplicate]
问题 This question already has answers here : Check if property is set in Core Data? (2 answers) Closed 4 years ago . I have a UITableViewController loading its entries from Core Data via a NSFetchedResultsController . Like this: let historyItem = fetchedResults.objectAtIndexPath(indexPath) as HistoryItem historyItem has a title property defined like this: @NSManaged var title: String So in cellForRowAtIndexPath the code says cell?.textLabel?.text = historyItem.title and that should all be fine.