我在if语句中收到错误消息
if (SelectedJobFunctions.contains(JobFunctions[indexPath.row])){
cell.accessoryType = .Checkmark
}
else {
cell.accessoryType = .None
}
这是数组
var JobFunctions = ["Cleaning","Admin","Slacking","Business"]
var SelectedJobFunctions = []
我试图查看用户是否已选择某个功能,如果已选择该功能将在SelectedJobFunctions
数组中,则会添加一个复选标记
答案 0 :(得分:0)
尝试在SelectedJobFunctions中指定数组类型,例如
var JobFunctions = ["Cleaning","Admin","Slacking","Business"]
var SelectedJobFunctions:[String] = []
if (SelectedJobFunctions.contains(JobFunctions[indexPath.row])){
cell.accessoryType = .Checkmark
}
else {
cell.accessoryType = .None
}