How would I access decoded JSON data?

Hello everyone!
I know this is a very beginner question so please do forgive me but I can't seem to figure it out.
Also I do apologize if I use any incorrect verbiage, Im still learning all the correct terms.

After a while of typing away and reading several documents I finally managed to make a correct model for my JSON data. Im able to make a request with Almofire and then pass the data to a struct to be decoded and then debugPrint out the results.

How would I go about accessing or saving the data? When I attempt to call the directly struct I can access its CodingKeys but then when I try to print out it comes out as CodingKeys(stringValue: \"name\", intValue: nil) and won't show any of the data. Is there a cleaner way to access the data that I'm just simply overlooking?

EDIT: Here is the full code in a GitHub gist

You shouldn't access CodingKeys at all unless you're doing something advanced, accessing properties DataStruct directly should be enough.

From the AlamoFire docs it looks like the response in your completion handler should be of type AFDataResponse<LTCStruct> so response.value in your handler should give you your LTCStruct.

You may want to have a look at some Swift Codable tutorials, such as
this.

Terms of Service

Privacy Policy

Cookie Policy