Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct ActionSheet {
- let title: String
- let buttons: [Button]
- var AlertController: UIAlertController {
- let alert = UIAlertController(title: self.title, message: nil, preferredStyle: .ActionSheet)
- for button in self.buttons {
- alert.addAction(button.AlertAction)
- }
- alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: nil))
- return alert
- }
- }
- struct Button {
- let title: String
- let handler: ((UIAlertAction) -> Void)?
- var AlertAction: UIAlertAction {
- return UIAlertAction(title: self.title, style: .Default, handler: self.handler)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement