I've just recently started learning Swift, and as part of one of my programs, I've been trying to maintain an array of class instances and use .append to add new instances to the array of classes.
However, when attempting to append a new class instance to the array, the "Extra Argument in Call" error appears. I have been sure to specify data types for all variables to ensure that there is not a compiler error with conflicting data types, but this has still not fixed the problem.
Here is the code:
import UIKit
var personMgr: personManager = personManager()
class person{
var name:String = "Default"
var description:String = "Default"
var presentIdeasDict:[Int: String] = [
0: "nil"
]
var presentLinkDict:[Int: String] = [ //Use same key for name of present idea and link for the present
0: "nil"
]
}
class personManager{
var people = [person]()
func addPerson(name: String, description: String){
people.append(person(name: name, description: description, presentIdeasDict: [0: "nil"], presentLinkDict: [0: "nil"]))
}
}
The error says "Extra argument 'name' in call in the line:
people.append(person(name: name, description: description, presentIdeasDict: [0: "nil"], presentLinkDict: [0: "nil"]))