ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -


i'm working on app using core data , nsfetchedresultcontroller many reasons switch use realm. saw there "realm version" of nsfetchedresultcontroller on github wouldn't compatible current code using core data.

the view controller displaying list of people same school, address book. list sublist of people studied in same city.

so thinking make 1 unique request database retrieve list of people , filter locally list within 1 dictionary per school [string: anyobject] string section name within tableview , anyobject array of people.

  1. first solution, make nsfetchedresultcontroller each school predicate filtering location. delete actions etc.. handled delegates -> not compatible realm

  2. create dictionaries , update them each actions... -> works realm it's annoying code.

any better solution?

edit:

i need clarify request: i'd write class inherit uitableviewcontroller.

  • this class has list of people sorted in alphabetical order
  • the tableview has section first letter of firstname
  • the tableview controller needs handle updates of data model (insert, update, delete)

as might move coredata realm, i'd write code compatible both don't need modify again later. "smart" way found far forget nsfetchedresultcontroller , rbqfetchedresultscontroller, because respectively linked coredata , realm, , use data structure dictionaries.

just clarify, you're creating uitableview multiple sections; 1 per school, , want sort flat list of people in realm database table based on school, correct?

if realm fetched results controller mentioned (i'm guessing it's rbqfetchedresultscontroller) doesn't fit app's architecture, yeah, dictionaries way go, shouldn't 'manual' you'd think.

the thing realm results objects 'live' in sense if new item added realm after results query made, it'll retroactively updated include new item. being case, long you're managing dictionary of results objects each relate fetching people each specific school, manual aspect managing table sections themselves.

the thing aware of you'll need mechanism notified when new person has been added specific school (in order know refresh section of table view), now, best if did in own logic (either through callback block, or delegate call).

on sidenote, we're in middle of adding set of new apis make implementing native fetched results controller behaviour possible in realm (i.e., automating need post notification when new object added). haven't got proper release date confirmed yet, should within first quarter of 2016! :)


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -