Post

Replies

Boosts

Views

Activity

Reply to SwiftData doesn't parse my object correctly
I have correct my bug. It seems like that there is a temporary storage. When I scan my products the nutriscore seems to be stored only in that session. When I close the app and open it again, the nutriscore is not shown. I just believe think that there is an error with deeply nested models maybe? this is the important part of the json. maybe wait for wwdc 2024? "nutriscore" : { "2023" : { "score" : 0, "category_available" : 1, "grade" : "a", "data" : { "positive_points_max" : "18.0", "is_cheese" : "0.0", "components" : { "negative" : [ { "points_max" : 10, "unit" : "kJ", "points" : 0, "value" : 0, "id" : "energy" }, { "unit" : "g", "points" : 0, "value" : 0, "points_max" : 10, "id" : "sugars" }, { "unit" : "g", "points" : 0, "id" : "saturated_fat", "value" : 0, "points_max" : 10 }, { "points" : 0, "unit" : "g", "value" : 0, "id" : "salt", "points_max" : 20 }, { "points" : 0, "value" : 0, "id" : "non_nutritive_sweeteners" } ], "positive" : [ { "id" : "proteins", "points" : 0, "unit" : "g", "value" : 0, "points_max" : 7 }, { "unit" : "g", "value" : 0, "id" : "fiber", "points" : 0, "points_max" : 5 }, { "points_max" : 6, "value" : 0, "unit" : "%", "id" : "fruits_vegetables_legumes", "points" : 0 } ] }, "is_beverage" : "1.0", "count_proteins" : "1.0", "negative_points" : "0.0", "negative_points_max" : "50.0", "count_proteins_reason" : "beverage", "is_fat_oil_nuts_seeds" : "0.0", "is_red_meat_product" : "0.0", "positive_nutrients" : [ "proteins", "fiber", "fruits_vegetables_legumes" ] }, "nutriscore_applicable" : 1, "nutriscore_computed" : 1, "nutrients_available" : 1 } },
May ’24