UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

CoreData and LSTypeIsPackage

Forums > SwiftUI

I want to be able to have my CoreData persistent store in a folder which is a package. The idea is I want the app data to be able to be opened, saved, or copied by the user as a single file (think .pages, .numbers, etc) as opposed to having to dig through ~/library/Application Support/app-name/... to get the three SQLLite files and move them someplace.

Can anyone say if this is even possible? So far all my attempts to figure this out have ended in CoreData throwing error during initialization of the Persistent Store.

The problem I am having is trying to telling PersistentContainer that the store should be inside the package instead of a folder.

Suggestions?

If this isn't possible (seems like it should be) then I will need to change my design to use a Document store instead, but I would like to stay with coredata if possible.

2      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.