Requesty is an application that makes an api call to http://127.0.0.1:5001/rincon_posts_payload/sudo_let_me_in and receives a [[String:Any]] aka list of dicts.
The request includes a body that gets JSONSEralized.
The response is the posts in the rincon.
API in localhost
I am using Flask Framework to server the API – TuRinconApi.
Next Step: make a copy of this, create classes to properly decode the list of dictionary reaposne.
The Next, next step is to receive images from TuRinconApi
Github repo: here
This application improves on RequestyRincón by making classes for the posts to decode the response.
This application builds on 02 will call "/rincon_posts_payload03/"
· “Call Tu Rincón API”: makes call to "/rincon_posts_payload03/" and even sets and saves the data in CoreData.
o Inside fetchPosts there is a line where it saves to core data. If this is commented it the data will not save it will still be set temporarily in Core Data but not persist after the application is turned off.
· “Fetch From Core Data”: makes call to the database (Core Data) and sets the data in the HomeVC.
Next decouple the saving from fetchPosts.
Have three buttons
-call api: calls and sets data in Core data
-save to persist data: saves data in core data
-fetch data from core data: populate the label with the core data
Problem with processingPost. Going to start RequestRincon05 from the beginning and use Result<success, error> all the way through.
Fetch request to api
Set in core data
Save persistently to core data
Display to UI
Notes after finishing
Prior to completion there are no errors:
2023-04-16 18:40:34.722396+0200 RequestyRincón05[58241:14911967] [Storyboard] Unknown class _TtC17RequestyRincón056HomeVC in Interface Builder file.
2023-04-16 18:40:34.723063+0200 RequestyRincón05[58241:14911967] [WindowScene] There is no scene delegate set. A scene delegate class must be specified to use a main storyboard file.
I think this error might be due to the “ó” used in the name
LEFT OFF: Redo the project but with out the ó in the name.
Copied RequestRincón05 (added a little more) removed “ó” and it runs with no errors.
I found sqlite database. The data is in the database.
The application has successfully decoupled:
· API call
· Save to core data – no duplicates based on post_id using NSPredicate
· Display core data
Github repo: here