Created
January 7, 2022 20:37
-
-
Save JRNelsonJR/f8decc348b6fff3dabda943bec46b022 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
class Recipe: Identifiable, Decodable { | |
var id:UUID? | |
var name:String | |
var featured:Bool | |
var image:String | |
var description:String | |
var prepTime:String | |
var cookTime:String | |
var totalTime:String | |
var servings:Int | |
var highlights:[String] | |
var ingredients:[Ingredient] | |
var directions:[String] | |
} | |
class Ingredient: Identifiable, Decodable { | |
var id:UUID? | |
var name:String | |
var num:Int? | |
var denom:Int? | |
var unit:String? | |
} | |
for r in recipeData { | |
r.id = UUID() | |
// this where the value of type 'String' error has no member 'id' is showing up | |
for i in r.ingredients{ | |
i.id = UUID() | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment