Dismissing Keyboard not working

Hi there, I would like some help regarding the issues I have.

On the book, in the Dismissing the Keyboard part of the chapter, I followed the book’s instruction but when I tap the background of the view, it did not dismiss the keyboard. Can anyone help? Here’s my code.

import UIKit

class ConversionViewController: UIViewController {
    @IBOutlet var celsiusLabel: UILabel!
    @IBOutlet var textField: UITextField!
    @IBAction func dismissKeyboard(_ sender: UITapGestureRecognizer) {
    @IBAction func fahrenheitFieldEditingChanged(_ textField: UITextField) {
        if let text = textField.text, !text.isEmpty {
            celsiusLabel.text = text 
        } else {
        celsiusLabel.text = "???"

I am also uploading a file that shows the connection of the ConversionViewController respectively. Help would be appreciated.

You may have dropped the Tap Gesture Recognizer on to the wrong object when you dragged it out.

I have deliberately done that, and I immediately experienced the same problem.

Delete the existing Tap Gesture Recognizer, and drag a new one, making sure that you drop it on to the view that contains the textField, not on to the textField itself, and connect it to the action method.

This worked for me. I made sure the View under Conversion View Controller was highlighted first - then drag-n-drop the Tap Gesture Recognizer onto the View.