Q:

Swift tableView.reloadData() seems not working

I've just created a new project using CoreData with the "Master-Detail Application" template. I'm using the code provided by Apple, I just added a NSPrediate in the fetchController
        var fetchedResultsController: NSFetchedResultsController {
        if _fetchedResultsController != nil {
            return _fetchedResultsController!
        }

        let fetchRequest = NSFetchRequest()
        // Edit the entity name as appropriate.
        let entity = NSEntityDescription.entityForName("Event", inManagedObjectContext: self.managedObjectContext)
        fetchRequest.entity = entity

        // Here the code i added <<<<<<<<
        fetchRequest.predicate = NSPredicate(format: "year = %d", self.selectedYear)

        // Set the batch size to a suitable number.
        fetchRequest.fetchBatchSize = 20

        // Edit the sort key as appropriate.
        let sortDescriptor = NSSortDescriptor(key: "timeStamp", ascending: false)
        let sortDescriptors = [sortDescriptor]

        fetchRequest.sortDescriptors = [sortDescriptor]

        // Edit the section name key path and cache name if appropriate.
        // nil for section name key path means "no sections".
        let aFetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.managedObjectContext, sectionNameKeyPath: nil, cacheName: "Master")
        aFetchedResultsController.delegate = self
        _fetchedResultsController = aFetchedResultsController

        var error: NSError? = nil
        if !_fetchedResultsController!.performFetch(&error) {
             // Replace this implementation with code to handle the error appropriately.
             // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 
             //println("Unresolved error \(error), \(error.userInfo)")
             abort()
        }

        return _fetchedResultsController!
    }    

where selected.Year is a simple var. I also added a UIButton connected to an IBAction that will change the value of selectedYear.
    @IBAction func changeYear(sender: AnyObject) {
            self.selectedYear = self.selectedYear + 1
            self.tableView.reloadData()
        }

(I logged the func changeYear and it's called)
So after that i'm calling self.tableView.reloadData() to update the UITableView that should now fetch different records depending on the new predicate, but the tableView is never updated 
(I tried to log the delegate methods but are never fired).
What am i missing? 
I also tried to make the tableView an IBOutlet from storyboard and tried to call self.tv.reloadData(), but still nothing.

A:

The fetched results controller does not work this way. You need to tell it to re-fetch based on the new predicate: 
_fetchedResultsController = nil
self.tableView.reloadData()

The other way is to change the predicate of the fetch request of the FRC and call 
self.fetchedResultsController.performFetch(&error)

Then there is no need to reload the table with reloadData() because the delegate should take care of it. But I presume that you are completely replacing the contents of the table, so the above solution is probably easier and just as performant. 

