Created
February 26, 2015 01:12
-
-
Save mgp/37f1d2d452f526ba52f1 to your computer and use it in GitHub Desktop.
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
/** | |
UIAlertViewDelegate used when the user can only go back, and so the associated handler | |
has no parameters. | |
*/ | |
private class BackOnlyErrorDelegate: NSObject, UIAlertViewDelegate { | |
private let handler: () -> Void | |
private init(handler: () -> Void) { | |
self.handler = handler | |
} | |
func alertView(alertView: UIAlertView, clickedButtonAtIndex buttonIndex: Int) { | |
switch buttonIndex { | |
case alertView.cancelButtonIndex: | |
handler() | |
default: | |
logAndAbort("UIAlertView selected an option that was not cancel") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment