0

Imagine I have a data model that has 2 entities: Movie and Genre.

A Movie can belong to many Genres, as a Genre can have many Movies.

Now. I want to have a NSFetchedResultsController that observes the Genre entity (using the genre's name as a sectionNameKeyPath)

Say I import some data, and a Genre gets a Movie added to it during the import.

The question is: Will the NSFetchedResultsController delegate (controllerWillChangeContent: , etc.) methods be called (because the Genre.movies.count has changed)?

If not, how can I make that happen? In Swift?

(Yes I know there are other questions like this out there, but none seem to be succinct or have an official answer)

(May be related to this issue:)

Community
  • 1
  • 1
horseshoe7
  • 2,745
  • 2
  • 35
  • 49

2 Answers2

1

Yes, it will update if the relationship on the entity updates. It will not update if a property in Movie changes even if the predicate is set to monitor that.

Jon Rose
  • 8,373
  • 1
  • 30
  • 36
0

YES, on import of a Movie to a Genre, controllerWillChangeContent: of the FetchedResultsController observing Genre will be invoked.

ystack
  • 1,785
  • 12
  • 23