Core Data

Discussion in 'iOS Programming' started by grandM, Apr 15, 2019.

  1. grandM macrumors 65816

    grandM

    Joined:
    Oct 14, 2013
    #1
    Core Data uses fine with table views but I was wondering if you still use it a lot. Many apps are cloud based and BAAS like FireStore come with local storage.
     
  2. cmaier macrumors G5

    Joined:
    Jul 25, 2007
    Location:
    California
  3. SylvainLafrance macrumors newbie

    SylvainLafrance

    Joined:
    May 25, 2019
    Location:
    Québec, Canada
    #3
    Yes, I use CoreData.... Not sure if it's old school or not :)
     
  4. DaveBerry macrumors newbie

    DaveBerry

    Joined:
    May 27, 2019
    Location:
    UK, Yorkshire
    #4
    depends on the application. Core data is an object graph storage, so good for storing structured data but not so good for relational. If i just need to store info about say, Staff members I would consider Core Data. If the data is more complex, for example products, stock levels, transactions I would go with sqlLite.
     
  5. PhoneyDeveloper macrumors 68040

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
  6. grandM thread starter macrumors 65816

    grandM

    Joined:
    Oct 14, 2013
    #6
    But how do you keep it synced then with the cloud then?
    --- Post Merged, Jun 3, 2019 ---
    Would you then just leave CoreData entirely out? Or implement it and sync it with Realm in the cloud?
     
  7. PhoneyDeveloper macrumors 68040

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #7
    I've used Realm on the device. It would be instead of Core Data or sqlite. Storing data in the cloud is another story.
     
  8. Mascots, Jun 5, 2019
    Last edited: Jun 5, 2019

    Mascots macrumors 68000

    Mascots

    Joined:
    Sep 5, 2009
    #8
    I use and know Core Data pretty extensively and have deployed it in several apps, so my take is that it today's Core Data is pretty good.

    It has an great concept for managing entities, some nice magic with the runtime to make things easier, and is pretty straight forward. It can be verbose, but this generally allows for the ability to break components apart and overall I've found that leads me to be better organized with my model structure and setup. Besides that, you can easily find or make your own wrappers to reduce code redundancy if that's a problem. It's core (ha) focus is tracking objects and imo it does that well.

    It handles relational data just fine... and is a relational database (not just an ORM or graph database) so I'm not really sure why that was mentioned as a negative - I think that's worth expanding on if you can because I'm curious. The example you noted can be easily achieved in CD and I've modeled some pretty intense graphs before.

    The single biggest drawback and one that is a deal breaker for most is going to be data portability. There is no Core Data iCloud API anymore, so it is up to the developer to manage iCloud, CloudKit, or other service storage and synchronization (it can be done and there are some 3rd party frameworks out there for this). The default format Core Data stores in is not very portable, even though it's a SQLite file, so translating even just the database to something standardized is going to be some effort unless you want XML or to write your own adaptor.
     
  9. DaveBerry macrumors newbie

    DaveBerry

    Joined:
    May 27, 2019
    Location:
    UK, Yorkshire
    #9
    indeed, using sqlLite directly would exclude if from iCloud sync's. When I have use sqlLite for enterprise clients I used custom API's to Rest Web Api's that integrated with back end systems. iCloud integration wasn't even in the picture.
     

Share This Page

8 April 15, 2019