Hi John
You will need to add the two image sets to the Assets.xcassets
file (or same file (.xcassets
) as the other images) with the new-name
and new-name-thumb
where new name is the name of your item. eg black-bean-soup
and black-bean-soup-thumb
then in the menu.json file add it
"name": "Breakfast",
"items": [
{
{
"id": "1", // <- This can be any unique string that not in any other menu item
"name": "Black Bean Soup", //<- It needs the same spacing as image name without the "-"
"photoCredit": "John Smith",
"price": 100,
"restrictions": ["V", "N"],
"description": "This is the best of Soup you will every have!!!"
},
"id": "EDCD038C-036F-4C40-826F-61C88CD84DDD",
"name": "Maple French Toast",
"photoCredit": "Joseph Gonzalez",
"price": 6,
"restrictions": ["G", "V"],
"description": "Sweet, fluffy, and served piping hot, our French toast is flown in fresh every day from Maple City, Canada, which is where all maple syrup in the world comes from. And if you believe that, we have some land to sell you…"
},
what happens is the struct Menu Selection
it converts the name to the image name in Assets with this
var mainImage: String {
name.replacingOccurrences(of: " ", with: "-").lowercased()
}
var thumbnailImage: String {
"\(mainImage)-thumb"
}
as you see that it take the name in JSON and then replaces the space with "-" and makes it lowercase and for thumb adds -thumb which is then used to call image.
Hope that makes sense
Nigel