2

I have a requirement to keep the app size under 3MB. There will be small amount of offline data storage in the app. I would like to know if I should use SQLite or Core Data (Which I personally prefer) to have better app size.

I will be coding the app in SWIFT3. I found out that we would require to use a wrapper to use SQLite anyway, which is basically what Core Data offers.

P.S.: I would personally like to stick to SWIFT3 rather than switching to objectiveC. Any additional tips for better app size and, opinions on if I should switch to objectiveC would be much appreciated.

Aju Antony
  • 639
  • 6
  • 13
  • Do you mean the app package download size or the size of the app when it one the phone? – Jon Rose Jul 04 '17 at 07:28
  • 2
    1) Core Data is more than "basically a wrapper to use SQLite". 2) You *can* use SQLite directly from Swift: https://stackoverflow.com/a/28642293/1187415. – Martin R Jul 04 '17 at 07:41
  • Maintaining the code would be easy and handy if you'll use Core Data. – Ishika Jul 04 '17 at 07:44
  • 1
    I don't understand why you think that it could make a difference at all to the bundle download size. There is no SQL file created yet when the app is downloaded. The main issues with app download sizes are resources - like images and sounds. – Jon Rose Jul 04 '17 at 07:59
  • What did you measure when you tried it for your app? – CL. Jul 04 '17 at 08:13

1 Answers1

2

The answer is the usual "it depends".

If you are using it to store a minimal amount of data, like in this case, it really does not matter, but for ease of use and the easy methods of dealing with objects, I think that Core Data is a better choice. Nonetheless, it has its downsides (don't even get me started on thread concurrencies), but it's a useful extension for storing, especially if you are dealing with objects.

Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223
  • 2
    I am satisfied with this answer. After a LONG discussion with client and their technical team. We decided to use Core Data and SWIFT3 with an additional buffer space for 1.5MB, "just in case". Thanks :) – Aju Antony Jul 05 '17 at 07:46