Hello everyone,
I am new in this Forum and I would like to be active in it in order to help and be helped.
My problem is this one :
I have to create a Dictionary in Xcode that has a Key Value (type : String) and the associated value is an Array of Class called 'Food', practically it is an Array of instances of that type of class. In particular this Class has only one property, that is the name (String).
class Food {
var name : String
}I have to set the Dictionary in order to assign to every key value (for example "sweet", "meat" and "fish") the determined Array of type 'Food' that will contain all the possible istances of the Classes Food with already set the name of them
I don't know how to implement this concept inside the code.
I've tryed in this way :
var foodlist = [String : [Food]] ()Then I don't know how to instantiate the different cell of the array Food for every key value.
I try to do this in my own way but It always doesn't work. He returns Errors, so surely is written in a wrong way