Dorian Richard Dorian Richard - 7 months ago 20
Swift Question

Extra argument in call with Swift 2

I have an error like : extra argument in call with this code :

var profile: [[String: AnyObject]] = []
profile = []

profile.append(["last-name": nomText.text!], ["first_name": prenomText.text!], ["username": usernameText.text!], ["gender": gender.text!], ["address": AdresseText.text!], ["phone": TelText.text!], ["biography": biography.text!], ["avatar": "coucou.png"], ["cover": ""], ["dateOfBirth": AgeText.text!], ["language": langue.text!], ["spokenLang": "fr"])

Answer

Append operation expects only one array

var profile: [[String: AnyObject]] = []
profile = []

profile.append(["last-name": nomText.text!]);
profile.append(["first_name": prenomText.text!]);

can do it element by element.