Decode api swiftui

Topic summary

Issue: In SwiftUI, the author fetches product data from an API and can print it to the console, but decoding the response yields nil, so nothing appears in a ListView.

Goal: Display a list showing products.title, products.variants.price, and products.image.src.

Request: Guidance or an example on correctly decoding the API response and binding the decoded data to a SwiftUI List.

Details: No code snippet or schema was provided, so the exact decoding failure (e.g., data/model structure) is unspecified.

Status: Unresolved; awaiting suggestions or sample code to decode the response and render the specified fields in SwiftUI.

Summarized with AI on February 22. AI used: gpt-5.

Hi there!

Working in SWIFTUI

I’m trying to load all the products in a ListView in Swiftui

After getting the data from the API .I can see it the console, but after decondig I’m getting a nil

and off course nothing shows in my view

please help!!

I need to show in a list :

products.title

products.variants.price

products.image.src

can someone guide with an example

Thank you very much