I'm having some trouble running a function after the return key is pressed on keyboard. I'm trying to get the keyboard to be dismissed when the return key is pressed but I found that the function is not being run at all. If anybody could please take a look I'd greatly appreciate it. Thanks!
class ViewController: UIViewController, UITextFieldDelegate {
    override func viewDidLoad() {
        super.viewDidLoad()
        addWelcomeLabel()
        print("view running")
        self.nameRequestField.delegate = self
    }
    let nameRequestField = UITextField(frame: CGRect(x: 0, y: 0, width: 330, height: 40))
    func textFieldShouldReturn(textField: UITextField) -> Bool {
      //nameRequestField.resignFirstResponder()
        print("hello")
        return true
    }
}
 
     
     
     
     
    