I'm trying to create multiple instances of a structure in an elegant way.
I have an array with names:
let instanceNames = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]
and a structure to go along with that:
struct days {
var date = ""
var description = ""
var otherValue = ""
}
What I want to end up with is this:
var Monday = days()
var Tuesday = days()
var Wednesday = days()
var Thursday = days()
var Friday = days()
Is there a way to do this in one line, I tried this but of course it didn't work:
for day in instanceNames {
var day = days()
}
Any help would be appreciated much!