Coder221 Coder221 - 1 year ago 81
Swift Question

Errors with core data after upgrading to Xcode 8 and converting to Swift 3

I am getting following errors

enter image description here

after I upgraded my Xcode to Xcode 8 and converted syntax to swift 3. Does that mean that AppDelegate does not support those functions anymore?

Answer Source

NSFetchRequest and NSFetchedResultsController are now generic classes in Swift 3. You'll need to declare your fetch request and results controller with the types they are fetching. Something like this:

var frc: NSFetchedResultsController<Item> = NSFetchedResultsController()


func fetchRequest() -> NSFetchRequest<Item> {

    let fetchRequest = NSFetchRequest<Item>(entityName: "Item")