错误:无法下标'inout [Agenda]'类型的值(又名'inout Array <Agenda>')

Ann*_*kes 2 arrays uitableview ios swift

我正在制作一个应用程序,当你按下按钮说紧急时,有一个标签上写着"紧急".我实现与按钮的用户交互之前,我有有一些对象的数组(如下图所示)urgent = true,但有一些urgent = false,这样我就可以用我的代码开始了.

该数组位于MainTableViewController.swift:

var content:[Agenda] = [
    Agenda(subject: "Read this article", deadline: "1-2 days", urgent: false),
    Agenda(subject: "Respond to this email", deadline: "ASAP", urgent: true),
    Agenda(subject: "Add this to diary", deadline: "When at home", urgent: true),
    Agenda(subject: "Listen to this song", deadline: "When finished working", urgent: false),
    Agenda(subject: "Check out this holiday destination", deadline: "At the weekend", urgent: false),
    Agenda(subject: "Download this podcast", deadline: "1-4 days", urgent: false),
    Agenda(subject: "Update notes", deadline: "When at home", urgent: true)
]
Run Code Online (Sandbox Code Playgroud)

然后,我有一个叫做类Agenda.swift,我声明subject,deadlineurgent.

这是我显示"紧急"的代码:

if content[indexPath.row].urgent = true {
        cell.urgentLabel.text = "URGENT"
    } else {
        cell.urgentLabel.text = ""
    }
Run Code Online (Sandbox Code Playgroud)

在第一行,我收到以下错误:

无法下标'inout [Agenda]'类型的值(又名'inout Array')

vad*_*ian 6

它是经典赋值运算符(=)与方程运算符(==)混淆.