Cocoa data hierarchy and browser

I am trying to implement something similar to the iTunes browser, to the browser of a simple book database. I have the following objects - Author , Genre and Book . I would like to display a list of authors and a list of genres that act to filter the main list of books.
I tried to do this in two different ways: modeling:

Author ( has many ) Genres ( has many ) Books

... with several instances of the same genre, so each author has his own name for a particular genre, I have a good drilling hierarchy displayed in my tabular views (albeit a little illogical to duplicate genres). However, when I select several authors, I finish showing the hype of the same genre, because they are, in fact, separate objects.

So, I tried to do this, more intelligently, with this relationship:

Author ( has many ) Books  
Book ( has one ) Genre

Genre, (), , (), , CurrentGenre.books, Author. " " , , , . Apple :

" Builder setFetchPredicate:.

, , . Cocoa -esque, " " . , , IB, !

.

+3
1

"" , , "".

. :

↔ >
→ >

, , :
↔ > ( ..)
↔ > ( )

, , , , .

UPDATE
:

  • "bookFilterPredicate" .
  • Author Genre.
  • selectedObjects .
  • : self.bookFilterPredicate = [NSPredicate predicateWithFormat:@"author IN %@ && genre IN %@",authorArrayController.selectedObjects,genreArrayController.selectedObjects];
+2

Source: https://habr.com/ru/post/1733105/


All Articles