RSDAlertPresenter
@objc
public protocol RSDAlertPresenter : NSObjectProtocol
Utility for presenting alerts
-
Present a view controller using a modal presentation.
Declaration
Swift
func presentModal(_ viewController: UIViewController, animated: Bool, completion: (() -> Void)?)
-
presentAlertWithOk(title:message:actionHandler:)
Extension methodPresent a pop-up alert with only an
OK
button.Declaration
Swift
func presentAlertWithOk(title: String?, message: String, actionHandler: ((UIAlertAction) -> Void)?)
Parameters
title
The title to display in the popup.
message
The message to display in the popup.
actionHandler
The action handler to call when completed.
-
presentAlertWithYesNo(title:message:actionHandler:)
Extension methodPresent a pop-up alert with a
Yes
andNo
button. The alert will be presented with yes and no buttons. The handler will be called withfalse
if the user selectedNo
andtrue
if the user selectedYes
.Declaration
Swift
func presentAlertWithYesNo(title: String?, message: String, actionHandler: @escaping ((Bool) -> Void))
Parameters
title
The title to display in the popup.
message
The message to display in the popup.
actionHandler
The action handler to call when completed.
-
presentAlertWithActions(title:message:preferredStyle:actions:)
Extension methodPresent an alert with the provided list of actions.
Declaration
Swift
func presentAlertWithActions(title: String?, message: String, preferredStyle: UIAlertController.Style, actions: [UIAlertAction])
Parameters
title
The title to display in the popup.
message
The message to display in the popup.
preferredStyle
The preferred style of the alert.
actions
The actions to add to the alert controller.