I’m looking to get data from an API, save that data in some @Published variables in my app, then store that API data in Firebase. Here’s what I’m thinking:
Get data from API
Push that data to Firebase
Add the API data to published variables in my app
Does this seem like a sound way to go about this? Another way I’ve thought about doing it is:
Get the data from API
Directly store that data in Firebase
Pull that data from Firebase and store it in my @Published variables.
No, the user shouldn’t be able to edit this API data. They have other editable data that will be pushed to Firebase from the app. Together, both data sources will be analyzed to present the user with useful analytics.
I would do option 2, but for this part: “Directly store that data in Firebase”
I would do this on firebase itself, not on the app, so look into Firebase cloud functions (but that also kind of depends what the data is and if it’s specific to each user
If it is, then it’s okay to do on the app
But if it’s general for every user, do that all on the backend
I will be grabbing personal sales from the API, storing it into Firebase and then fetching that data to the app depending on the user who is logged into the app.