Alert Operation

AlertOperation is an operation which can be used to present a UIAlertController.

// Presenting an alert from inside a view controller
let alert = AlertOperation(presentAlertFrom: self)

// Configure the alert's title and message
alert.title = NSLocalizedString("A title!", comment: "A Title!")
alert.message = NSLocalizedString("This is a message.", comment: "This is a message.")

// Add actions, if no actions are added, a default
// action (Okay) with no block is added.
alert.addActionWithTitle(NSLocalizedString("Ok", comment: "Ok")) { _ in
    print("Did press ok!")
}

// Add it to the queue...
queue.addOperation(alert)

A nice feature of this is that the alert operation is mutually exclusive, which means that no other AlertOperation instances can be executed until it is dismissed.

๐Ÿ“˜

UserConfirmationCondition

The UserConfirmationCondition is essentially an AlertOperation but used as a condition.