Using Core Data Lab
Sometime ago I bought this app called Core Data Lab. The app helps inspect CoreData stores created by my mac apps. This is very handy when building Mac apps (probably iOS apps too).
The entire walkthrough assumes that you are using Xcode to build your mac app.
Open CoreDataLab
Click on “Create a new Core Data Lab project”.
Choose your app file (the one you are building)
When creating a new CoreDataLab project, the app file has to be chosen first.
- Click on “Select App”. This opens the file picker window.
- If you are using Xcode to build your mac app, then the use the keyboard shortcut
cmd+shift+G
to invoke a prompt to enter a custom folder path - Enter the path
~/Library/Developer/Xcode/DerivedData
and hit the enter key - Within this directory, look for your app’s folder.
If your app is called Hello
, then the folder would look something like Hello-23erwfaewra
(some random string follows the folder name).
Within your app’s directory, navigate into the following folder structure to find your .app
file.
Build
-> Projects
-> Debug
-> Hello.app
After selecting the app, continue to setup the database path
- Like how the app was selected, click on “Select database”
- Use the
cmd+shift+G
shortcut to enter a custom path - If your app’s identifier is
app.example.Hello
, then look for a directory like below:
~/Library/Containers/app.example.Hello/
Once inside, navigate to the following path to find the SQLite database file (path depends on your app name).
Data
-> Library
-> Application Support
-> Hello
-> Hello.sqlite
The final path will look something like below. Click on the “Continue” button to proceed.
~/Library/Containers/app.example.Hello/Data/Library/Application Support/Hello/Hello.sqlite
Final step: Give your project a name
Once the project is named, that is the end of the setup. Feel free to explore the data for your CoreData models.
Link - Core Data Lab website