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

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?

2      

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).

2      

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!

2      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

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.