Hello! im doing a Corona tracker app and taking the data from postman API.
So, im using a alert with a textfield for the user can write the name of the country that wants to look the covid cases, recovered, and so on.
This is the error: typeMismatch(Swift.Dictionary<Swift.String, Any>, Swift.DecodingError.Context(codingPath: , debugDescription: “Expected to decode Dictionary<String, Any> but found an array instead.”, underlyingError: nil))
I’ll really be so thankful that some can help me, I can’t see the right process to follow, im blocked idk what else to do.
Here is SS of the app:
The Label with “Mexico” written on the second SS (DetailViewController) is written by me on storyboard. its not from the JSON, unfortunately
in the HomeViewcontroller I could do that the data show in the labels and there is a button fo three dots to the right of the countryLabel, That button is for more details (tests, case per one million, …).
how can I do that the the text that the user writes on the textfield of the alert also works for the DetailViewController? im trying to use the same “updateData()” Function, I think that that’s not the problem. maybe yes, idk. I’ve tried many thing and been like this for a couple of days. now im trying with realm, save the text of the UIAlertController to the realm DB and then fetching it from the DetailViewContorller()
This is the JSON:
This is the code for fetching the data:
this is the code for put the data on the UI: