I am following a great book from AppCoda, it was working on IOS8 but give many errors now:
// Load menu items from database if let managedObjectContext = (UIApplication.sharedApplication().delegate as! AppDelegate).managedObjectContext { let fetchRequest = NSFetchRequest(entityName: "MenuItem") var e: NSError? menuItems = managedObjectContext.executeFetchRequest(fetchRequest, error: &e) as! [MenuItem] if e != nil { println("Failed to retrieve record: \(e!.localizedDescription)") } } After Conversion to IOS9:
// Load menu items from database if let managedObjectContext = (UIApplication.sharedApplication().delegate as! AppDelegate).managedObjectContext { let fetchRequest = NSFetchRequest(entityName: "MenuItem") let e: NSError? menuItems = (try! managedObjectContext.executeFetchRequest(fetchRequest)) as! [MenuItem] if e != nil { print("Failed to retrieve record: \(e!.localizedDescription)") } } So I change back "let by var" and still get a warning = Variable 'e' was never mutated; consider changing to let constant. I need var in this block, how can I get rid of this warning? Any help is more than welcome
varif you're never mutating it?