Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSFetchedResultsController deleteCache in Swift 3

Currently migrating to swift 3 and can't quite figure out what the parser wants for NSFetchedResultsController.deleteCache(withName: "rootCache")

With this syntax, I'm getting a "Type 'String?' does not conform to protocol 'ExpressibleByStringLiteral'" error when building.

like image 749
HavenB3 Avatar asked Sep 15 '16 17:09

HavenB3


1 Answers

The error message is misleading. As of Swift 3, NSFetchedResultsController is a generic type

open class NSFetchedResultsController<ResultType : NSFetchRequestResult> : NSObject { }

and the following should work:

NSFetchedResultsController<NSFetchRequestResult>.deleteCache(withName: "rootCache")
like image 82
Martin R Avatar answered Oct 09 '22 07:10

Martin R