title: create alert function in all view controllers - swift
body: <p>I'm trying to declare a function for showing alerts in my app. To avoid repeating work, i'm trying to use same function for all my app. I tried to do that by creating a class with function showNotification. but when i create an object of that class and call the method, nothing happens. How can i do that?</p>
  
  <pre><code>class SharedPropertiesAndMetods : UIViewController {
  
      func showNotification(title: String, message: String)
      {
          let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
          let defaultAction = UIAlertAction(title: "تائید", style: .default, handler: nil)
          alertController.addAction(defaultAction)
          present(alertController, animated: true, completion: nil)
      }
  
  }
  </code></pre>