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

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -