swift - Appending Tuples to an Array of Tuples? -


i'm trying make array of tuples store data of to-do-list app can't figure out how append tuples array. here code:

first, array declared globally:

var eventlist : [(name: string, date: string)] = [] 

here's code tried use, complier error saying "missing argument parameter 'date' in call". (this line of code inside buttonpressed action)

eventlist.append((name: titlefield.text, date: convertdate(eventdate.date))) 

why causing compiler error , how can fix it?

make typealias tuple , use it.

typealias mytuple = (name: string, date: string)   var eventlist : [mytuple] = []  var v: mytuple = (name: "a", date: "1") eventlist.append(v) eventlist.append((name: "b", date:"2"))  println(eventlist) 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -