File System vs Core Data for persisting data

I've tried googling this and the responses are quite dated. The iOS App Dev Tutorials from developer.apple's website, which is the most recent info on the subject, goes the File System route. Is one better than the other? Are you losing out on anything by not using Core Data? Is it perfectly fine to use the File System for data persistence? What are your thoughts?

It depends what type of data you save.

If they are highly structured, with relationship between entities, Core Data is preferable.

But if simple "flat" data, File is OK and simpler to use.

So it depends on the use case, but you did not tell anything about it.

Thanks for the reply! Absolutely right, I didn't tell much about what kind of data I plan on storing.

My app does use relationships, but at the same time, the data types are only strings and decimals with one boolean.

I have four entities total:

  • Bins has many Tickets
  • Drivers has many Tickets
  • Fields has many Tickets
  • Ticket belongs to a Bin, belongs to a Field, and Belongs to a Driver

Could I be just fine persisting to the File System, or would something like this be better off using Core Data?

I currently have it set up using core data, I'm just getting hung up when I'm creating my form for a Ticket. I go to use a picker to select what Field, picker for Driver, picker for Bin, but those are grayed out when I run the app. And I am struggling to find resources to help with that issue. I am using SwiftUI for this.

adding to Claude31, SwuiftUI's @FetchedResults, and the underlying NSFetchedResultsController, are IMHO a key reason to adopt CoreData: changes in the background at the model layer get signaled to the main thread view layer, which can then be dynamically updated. The other reason to use CoreData is enabling device-to-device synchronization (for a user with multiple devices, or data shared between users) via NSPersistentCloudKitContainer (or an open-source sync engine like CloudCore).

File System vs Core Data for persisting data
 
 
Q