title: How to show an alert from another class in Swift?
body: <p>I have a main class, <code>AddFriendsController</code>, that runs the following line of code:</p>
  
  <pre><code>ErrorReporting.showMessage("Error", msg: "Could not add student to storage.")
  </code></pre>
  
  <p>I then have this <code>ErrorReporting.swift</code> file:</p>
  
  <p>import Foundation</p>
  
  <pre><code>class ErrorReporting {
      func showMessage(title: String, msg: String) {
          let alert = UIAlertController(title: title, message: msg, preferredStyle: UIAlertControllerStyle.Alert)
          alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: nil))
          self.presentViewController(alert, animated: true, completion: nil)
      }
  }
  </code></pre>
  
  <p>Obviously, <code>self</code> wouldn't work here, and is giving me an error. How can I refer to the currently open view controller (i.e. <code>AddFriendsController</code> in this circumstance), as I am wishing to use this same method in many different swift files?</p>
  
  <p>Thanks.</p>