答案 0 :(得分:4)
您需要先初始化数组
var lstQuotations = [Student]()
答案 1 :(得分:0)
var lstQuotations = [Student]()
for i in 1...10 {
let stu = Student()
stu.id = "\(i)"
stu.name = "Student {\(i)}"
lstQuotations.append(stu)
}
创建这样的类:
class Student {
var id : String!
var name : String!
}