How to view recorded records in Core Data?

Asked

Viewed 89 times

0

I’m developing a small app on Swift for Macos, Everything was fine until you got to Core Data.

I was able to record and recover data, it’s okay that it wasn’t as good as I wanted, but since it’s the first implementation, I’m letting it go.

My difficulty is in being able to graphically visualize the data persisted in Core Data, currently I’m only able to do this via code. Is it possible to open the "database" for viewing by the Xcode itself? If so, how? Otherwise, what other alternative is there?

1 answer

1


You can view the database with DB Browser for Sqlite (https://sqlitebrowser.org/dl) opening the Coredata file

  • In the delegate app add this code to know where the bank file is in the simulator
let paths = NSSearchPathForDirectoriesInDomains(.libraryDirectory, .userDomainMask, true)
print("\(paths[0])")
  • Run the app and copy the path.

  • open the terminal and open the folder with open + copied path command

  • Enter the Application Support folder and copy the Coredatastack.sqlite file

  • Drag the file to DB Browser for Sqlite and enter the Browse Data tab

Browser other questions tagged

You are not signed in. Login or sign up in order to post.