Skip to content

Instantly share code, notes, and snippets.

@JRNelsonJR
Created January 7, 2022 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JRNelsonJR/f8decc348b6fff3dabda943bec46b022 to your computer and use it in GitHub Desktop.
Save JRNelsonJR/f8decc348b6fff3dabda943bec46b022 to your computer and use it in GitHub Desktop.
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