0

I have a UITapGestureRecognizer like so:

let tap = UITapGestureRecognizer(target: self, action: #selector(self.commentsPressed))

self.comments.addGestureRecognizer(tap)

self.comments is a UILabel and self.commentsPressed looks like this:

@objc func commentsPressed(recognizer: UITapGestureRecognizer) {

        let viewController = storyboard?.instantiateViewController(withIdentifier: "Comments") as! CommentsController

        viewController.postid = postid

        viewController.disabled = self.commentsDisabled

        viewController.userid = self.userid

        viewController.coverImageString = self.coverImageString

        self.navigationController?.pushViewController(viewController, animated: true)

    }

But when I press my UILabel, I get this error:

this class is not key value coding-compliant for the key commentButton.

This was working before I converted my code to Swift 4.2 and now all of sudden its not working, what am I doing wrong and how do I fix it?

user979331
  • 11,039
  • 73
  • 223
  • 418

0 Answers0