Я пытаюсь выполнить условный переход согласно приведенному ниже коду, что если идентификатор пользователя совпадает только с текущим идентификатором пользователя, тогда выполняется переход, но он не происходит так, как требуется, он выполняет переход без выполнения условного оператора. , чтобы вызвать функцию toChatView, условия должны быть истинными
кнопка находится в ячейке таблицы в контроллере таблицы, откуда должно вызываться действие
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "ItemCell", for: indexPath) as! CommentCell
cell.itemLikebutton.tag = indexPath.row
cell.itemLikebutton.addTarget(self, action: #selector(likeaction1(_:)), for: .touchUpInside)
cell.chatButton.tag = indexPath.row
cell.chatButton.addTarget(self, action: #selector(toChatView(_:)), for: .touchUpInside)
cell.set(comment: comments[indexPath.row])
return cell
}
@IBAction func toChatView(_ sender: Any) {
var currentUserId = Auth.auth().currentUser!.uid
if currentUserId == userId1 || currentUserId == UserId2{
performSegue(withIdentifier: "toMessageRoom", sender: self)
}
else{
self.view.makeToast("You are not authorized for this chatroom")
}
}
, теперь я получаюошибка при этом внутри функции подготовки*