ios - Create empty array of struct gives me an error -
i'm trying create empty array
of struct
. here's code:
struct item { var prop1 : nsdate var prop2 : nsdate } var myitem = [item()]
but error:
missing argument parameter 'prop1' in call.
what doing wrong, , how can fix it?
item()
trying create item
empty, that's not possible since neither prop1
nor prop2
have default values. automatically generated initializer requires 2 arguments.
to create empty array, can use 1 of these:
var myitem: [item] = [] var myitem = [item]() var myitem = [] [item]
Comments
Post a Comment