Rafa Febrer Rafa Febrer - 1 year ago 145
Swift Question

How to store data localy in swift osx app?

I'm working on my first osx App and I want to save arrays of objects that I've created on a "project file" like you do in any program when using the "save" button.

I have been looking different ways to do it, Core Data, Document based app, but, I'm not sure how it works any of them to choose the best option for my app.

I want to save arrays of objects that have inside more arrays and other strings and doubles that contain information of the app that the user added. ( It can be a lot of data ) So for that reason I think Userdefault is not a good idea.

I also want to make the app able to open one of this projects saved.

So, could you help me to find which is the best way to do it?

Answer Source

I can suggest you to read iOS FileSystem Overview.

You must use the Data container to locate your local files. For this, you have to locate the NSDocumentDirectory with the NSUserDomainMask (call to NSSearchPathForDirectoriesInDomains) and use standard NSFileManager class.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download