Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OS X App. Which is the best way to store data?

In a os x app, which is the best way to store hundreds of user record with a lot of information for each record?

I know that i can use CoreData, SQLite, Realm, plist or other solution. Which is the most compatible (i think for example for a web use) and clean/light/fast method/type of database to store data ?

thank

like image 732
Michele De Nardi Avatar asked Oct 06 '15 10:10

Michele De Nardi


People also ask

What is the best way to store files on a Mac?

Use iCloud Drive Not only will iCloud Drive help you keep your files organized into folders, but it will also sync them across multiple devices. So, if you're someone who uses a personal and a work Mac, or even just a desktop and an iPad, iCloud Drive is how your files will automatically be on every device.

Where apps store data OSX?

The preferences or settings for the Application by convention (as mentioned by Quora User) is the ~/Library folder. If it's a Mac App Store application that is storing content in iCloud then it's saved files are probably in ~/Library/Containers/etc.

How do I manage storage on macOS X?

Optimize storage with built-in tools To access them, open the Apple menu and click About This Mac > Storage. Then click Manage. To transfer all your large files, photos, and messages to the cloud, click Store in iCloud. With a free plan, you can clear up to 5 GB of storage space.

What should I backup on OSX?

To keep your files safe, it's important to back up your regularly. The easiest way to back up is to use Time Machine—which is built into your Mac—to back up your apps, accounts, preferences, music, photos, movies, and documents (it doesn't back up the macOS operating system).


2 Answers

Core Data is written by Apple to be used in Cocoa based applications. It is already included on the operating system, has 10 years of development behind it and is used in hundreds of thousands of applications on the app store already.

Using a third party library has tremendous risks associated with it.

I always recommend using Core Data on iOS and OS X because it is written by Apple, has a fully supported team of developers behind it and is a mature code base.

Using raw SQLite is possible but you will not get the same performance benefits as you will with Core Data.

Realm is focusing on the wrong things. Their data migration system is scary, they focus on raw speed when they need to be focusing on the overall picture. They might be targeting mobile but I do not agree with their goals.

Hundreds of records is not hard for any database system. It is when you get to 10s of thousands of records on a device that many of them start to fall down due to memory pressure (even on OS X).

Core Data is designed to help with the memory pressure. I am not aware of any third part framework that will do so.

like image 107
Marcus S. Zarra Avatar answered Sep 30 '22 18:09

Marcus S. Zarra


I think the most important thing is to compare Realm with the other database. Realm use its own core and the others are based on SQLite (CoreData use SQLite). Realm is the first database designed for mobile use. So with your case (OSX) you must consider if your app have the same functionning as mobile App: device restrictions.

Realm:

  • Very fast methods: see example here
  • Rapid execution: see benchmark here, yes thousands of user records!
  • Light: the embeded database less than 1MB

  • But in beta state. This mean that they are constantlyy in development

SQLite:

the "lite" in the name mean it's a light database. You have many libraries available in github to help you, full documentation and full examples.

Personnaly, I use Realm for My OSX App and despite it being in a beta state, I have all the features I need. Realm is faster than CoreData and save me thousand of lines of code and months of work. :)

I hope that this will help you.

like image 41
Masterfego Avatar answered Sep 30 '22 18:09

Masterfego