NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills today! >>

SOLVED: Can you view what is stored in Core Data?

Forums > SwiftUI

I am working on an app that leverages Core Data. I'm getting some strange results ( I'm sure my fault), but I'm trying to determine if I'm storing data incorrectly, or retreiving data incorrectly. Is there some sort of viewer so I can see what is actually being stored in Core Data?

   

In almost every case, Core Data stores data in an sqlite database. You can use a database viewer that supports sqlite to peek into the files. See this article for more info: Core Data and Database Browser for SQLite

If you are going to be doing a lot of looking under the hood and don't mind dropping some cash, there's Betamagic's Core Data Lab, which is quite good and is specifically designed to work with Core Data (as you might very well suspect from the name).

   

Core Data Lab was the exact thing I needed. They even have a free 14 day trial, but I'm shocked to see the app is only $20. Seems like a no brainer purchase.

I opened the app, and within seconds I saw my problem. I had defined an attribute of type UUID, but I never set the UUID so they were all nil.

Screen Shot

Adding id:\.self to my ForEach instantly solved the problem.

Thank you!

   

Hacking with Swift is sponsored by Judo

SPONSORED Let’s face it, SwiftUI previews are limited, slow, and painful. Judo takes a different approach to building visually—think Interface Builder for SwiftUI. Build your interface in a completely visual canvas, then drag and drop into your Xcode project and wire up button clicks to custom code. Download the Mac App and start your free trial today!

Try now

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

Reply to this topic…

You need to create an account or log in to reply.

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.