Hello! I am using OpenFoodFacts API in a Swift project. When creating my struct for the different data in the API, I listed the data under nutriments (proteins_serving, etc.) as “Double?”. When I run my line of code
print(“More information: calorie content: (String(describing: productResponse.product?.nutriments?.caloriesPerServing)))”)
, it outputs nil.
Please note that when I run the code
print(“Also wondering what the name is: (String(describing: productResponse.product?.productName))”)
, it returns the actual name of the product.
I tried Making the Data type double, float, and int, but none are working. Does anyone have experience with this?