I have been trying to migrate Swift project to latest Swift version.
fileprivate lazy var _uploadedSurveysController: NSFetchedResultsController? = nil This code line gives the following error.
Nil cannot initialize the specified type NSFetchedResultsController? Xcode comes up with a fix recommendation which is adding another question mark next to NSFetchedResultsController. When i say yes, it gives the same error and coming up with a fix adding another question mark.
Here is more code
fileprivate var uploadedSurveysController: NSFetchedResultsController { guard _uploadedSurveysController == nil else { return _uploadedSurveysController! } _uploadedSurveysController = NSFetchedResultsController(fetchRequest: coreDataHelper.mailedAssetsFetchRequest(), managedObjectContext: managedObjectContext, sectionNameKeyPath: "section2Identifier", cacheName: nil) do { try _uploadedSurveysController!.performFetch() } catch let error as NSError { Logger.sharedInstance.logMessage("\(#function) Uploaded Surveys Fetching Error: \(error.userInfo)") } return _uploadedSurveysController! } Any help would be really appreciated.
Just to let you know. I am really new to Swift and trying to update an existing project from Swift 2.3 to 3.
Thanks in advance. Remzi.
NSFetchedResultsControllerin Swift 3 needs a generic type declaration now. Can you include some more code where_uploadedSurveysControlleris used? (Initialised as not beingnil)