Skip to content

Instantly share code, notes, and snippets.

@dkotama
Last active September 10, 2018 00:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkotama/8efb77ba2f94316b2f751df5c729e960 to your computer and use it in GitHub Desktop.
Save dkotama/8efb77ba2f94316b2f751df5c729e960 to your computer and use it in GitHub Desktop.
Swift Show Multiple Choices Modal
// in case i want to copy paste thing
let alertCtrl = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
let galleryBtn = UIAlertAction(title: NSLocalizedString("select_image", comment: ""), style: .destructive, handler: { (action) -> Void in
self.openGallery()
})
let deletePhotoBtn = UIAlertAction(title: NSLocalizedString("delete_image", comment: ""), style: .destructive, handler: { (action) -> Void in
self.editProfilePresenter?.pushUpdateValue(.image_id, values: self.imageId)
self.editProfilePresenter?.pushUpdateProfile()
})
let cancelBtn = UIAlertAction(title: NSLocalizedString("cancel", comment: ""), style: .cancel, handler: { (action) -> Void in
print("CANCEL")
})
alertCtrl.addAction(galleryBtn)
alertCtrl.addAction(deletePhotoBtn)
alertCtrl.addAction(cancelBtn)
self.present(alertCtrl, animated: true, completion: nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment