PetreVane
10/9/2019 - 6:38 PM

ErrorsManager




class ErrorManager {

  static func showError(message: String, on viewController: UIViewController?, dismissAction: ((UIAlertAction) -> Void)? = nil) {
    weak var currentViewController = viewController
    DispatchQueue.main.async {
      let alertController = UIAlertController(title: "Error", message: message, preferredStyle: .alert)
      alertController.addAction(UIAlertAction(title: "Dismiss", style: .default, handler: dismissAction))
      currentViewController?.present(alertController, animated: true)
    }
  }
}