1
resposta

Não printa long press ao realizar a ação

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let row = indexPath.row
        let meal = meals[row]
        let cell = UITableViewCell(style: UITableViewCell.CellStyle.default, reuseIdentifier: nil)
        cell.textLabel!.text = meal.name
        return cell
        let longPressRecognizer = UILongPressGestureRecognizer(target: self, action: #selector(showDetails))
        cell.addGestureRecognizer(longPressRecognizer)    
}

Tive que usar o @objc para compilar assim como o xcode recomendou

    @objc func showDetails(){
        print("Long press now")
    }
1 resposta

Oi Marcello, tudo bem ?

Cara eu vi que sua dúvida é um pouco antiga, será que tu já resolveu ? Se sim pode compartilhar conosco ?

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software