SignalingAlert
public final class SignalingAlert<T>
A UIAlertController wrapper that sends values associated with alert actions to its output signal that emits values of type T
.
-
The underlying
UIAlertController
of the class is associated with.Declaration
Swift
public let controller: UIAlertController
-
The output signal the class is associated with.
Declaration
Swift
public let signal: Signal<T, NoError>
-
Initialize a
SignalingAlert
with the giventitle
,message
andpreferredStyle
.Declaration
Swift
public init(title: String?, message: String?, preferredStyle: UIAlertController.Style)
-
Add an action to the alert, sending the
event
when the user taps the action.Declaration
Swift
public func addAction(title: String, style: UIAlertAction.Style, event: Signal<T, NoError>.Event)
-
Add an action to the alert, sending the
event
when the user taps the action.Declaration
Swift
public func addAction(title: String, style: UIAlertAction.Style, value: T)
-
Ahelper factory method allowing to display a
SignalingAlert
on screen.Declaration
Swift
public static func producer( title: String? = nil, message: String? = nil, preferredStyle: UIAlertController.Style, presentingController: UIViewController, sourceView: UIView?, configure: ((SignalingAlert) -> ())? = nil) -> SignalProducer<T, NoError>
Parameters
title
The title of the alert
message
The message of the alert
preferredStyle
The preferred style of the alert
presentingController
The view controller to present the alert from
sourceView
The view that presents the alert, if on ipad and wanted to use a popover style Keep in mind that using a
sourceView
is required if using theactionSheet
style.configure
A closure allowing to customize the
SignalingAlert
, for example to add actions.Return Value
A
SignalProducer
that when started, will display the alert on screen. Note that thisSignalProducer
will retain all the parameters given inproducer
until it is started.