title: getting "Use of unresolved identifier 'self'" when trying to present AlertViewController
body: <p>I am trying to write a function that displays a <code>UIAlertController</code> when a <code>UITextField</code> is left empty.  I used the following <a href="https://stackoverflow.com/questions/36905329/shows-the-alert-when-uitextfields-are-full-or-empty-swift">example</a> to display the message.  At this stage, I get the following error:</p>
  
  <blockquote>
    <p>Use of unresolved identifier 'self'</p>
  </blockquote>
  
  <p>The code I have is below.</p>
  
  <pre><code>func displayMyAlertMessage(userMessage: String){
      let myAlert = UIAlertController(title: "Alert", message: userMessage, preferredStyle: UIAlertController.Style.alert)
      let okAction = UIAlertAction(title: "Ok", style: UIAlertAction.Style.default, handler: nil)
      myAlert.addAction(okAction)
      self.present(myAlert, animated: true, completion: nil)
  }
  </code></pre>