Last active
October 9, 2019 18:38
-
-
Save PetreVane/ff111701617ee04ce1b8ea62e63decd0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment