从初始化程序返回而不初始化所有存储的属性?

时间:2018-04-21 12:45:08

标签: ios swift

我使用单独的类来保存类中的对象。但它显示错误:“从初始化程序返回而不初始化所有存储的属性”。请帮我解决这个问题。

class FetchedExpectedVisitors
{
    var id: Int
    var name: String
    var email: String
    var phone: String
    var department_id: Int
    var employee_id: Int
    var location_id: Int
    var image: String
    var verification_code: String
    var qr_code: String
    var isVisited: Int
    var company_id: Int
    var purpose: String
    var meeting_date: String
    var meeting_time: String
    var duration: String
    var created_at: String
    var updated_at: String

    init(id: Int, name: String, email: String, phone: String, department_id: Int, employee_id: Int, location_id: Int, image: String, verification_code: String, qr_code: String, isVisited: Int, company_id: Int, purpose: String, meeting_date: String, meeting_time: String, duration: String, created_at: String, updated_at: String) {

        self.id = id
        self.name = name
        self.email = email
        self.phone = phone
        self.department_id = department_id
        self.location_id = location_id
        self.image = image
        self.verification_code = verification_code
        self.qr_code = qr_code
        self.isVisited = isVisited
        self.company_id = company_id
        self.purpose = purpose
        self.meeting_date = meeting_date
        self.meeting_time = meeting_time
        self.duration = duration
        self.created_at = created_at
        self.updated_at = updated_at   
    }   
}

1 个答案:

答案 0 :(得分:0)

self.employee_id = employee_id内添加init()