我编写自己的CoreDataStack文件,当我编译项目时,收到警告“Swift - 类型的值”(NSObject) - >() - > NotesListViewController'没有成员堆栈?“
class NotesListViewController: UITableViewController, NSFetchedResultsControllerDelegate {
var stack: CoreDataStack = CoreDataStack(modelName:"UnCloudNotesDataModel", storeName:"UnCloudNotes")
lazy var notes: NSFetchedResultsController = { (_) -> NSFetchedResultsController<NSFetchRequestResult> in
var request = NSFetchRequest<NSFetchRequestResult>(entityName: "Note")
request.sortDescriptors = [NSSortDescriptor(key: "dateCreated", ascending: false)]
var notes = NSFetchedResultsController(fetchRequest: request, managedObjectContext: self.stack.context, sectionNameKeyPath: nil, cacheName: nil)
notes.delegate = self
return notes
}()