forked from Polidea/RxBluetoothKit
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add AlertPresenter and presenting alerts on errors
- Loading branch information
Mikołaj Piechocki
committed
Oct 23, 2020
1 parent
b68887a
commit d085486
Showing
4 changed files
with
42 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import UIKit | ||
|
||
class AlertPresenter { | ||
|
||
static func presentError(with message: String, on viewController: UIViewController?) { | ||
let alert = UIAlertController(title: "Error", message: message, preferredStyle: .alert) | ||
alert.addAction( | ||
UIAlertAction( | ||
title: "Ok", | ||
style: .cancel, | ||
handler: { action in | ||
viewController?.dismiss(animated: true) | ||
} | ||
) | ||
) | ||
viewController?.present(alert, animated: true) | ||
} | ||
|
||
} |
This file contains 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
This file contains 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