Getting data from the API and saving it to the Realm?

There are manuals for creating your own arrays and putting them in the same Realm and Core Data, from there you can already take them and where you need to insert them. Everything seems to have been rummaged through and I can't find how to save the JSON obtained by the structure (codable) in the realm, so that later this data can be output in the TableView in which I need it. If fully describing your idea: There is a structure: Codable, I use it to get data and pass it to the 1st VC, in tableView. In this VC there is a button (+) by clicking which I want to transfer data from the cell to the Realm, then from the Realm to the 2nd VC, to the tableView and save it there(something like FavoritesViewController). I would also like to save the entire table of the 1st VC, so that the table is loaded from the realm without the Internet (a secondary task.)

It would be nice if you could describe every step. I would be very grateful.



Read more here: https://stackoverflow.com/questions/64960120/getting-data-from-the-api-and-saving-it-to-the-realm

Content Attribution

This content was originally published by Petuh Show at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: