I'm trying to create a simple data model in Swift. The model is a list, in which it will have items such as name, size, colour and store.
struct List{
var list: [String]
var name: String
var size: String
var colour: String
var store: String
init(var list:[String], name: String, size: String, colour: String, store: String){
self.list = list
self.name = name
self.size = size
self.colour = colour
self.store = store
list = [name, size, colour, store]
}
If I were to put list = [name, size, colour, store] at index 0, only name is there. How do I store multiple values for one index such that
Index 0: name1, size1, colour1, store1
Index 1: name2, size2, colour2, store2
listbelongs always to the instance which is created in theinitfunction and contains one item as long as the variable is not accessed from outside theListstructure.