Skip to content

Instantly share code, notes, and snippets.

@ulaganathan-PalaniVelayutham
Created March 9, 2023 11:43
Show Gist options
  • Save ulaganathan-PalaniVelayutham/ec9eda71f16ddc5f8f11100c3d7d17c9 to your computer and use it in GitHub Desktop.
Save ulaganathan-PalaniVelayutham/ec9eda71f16ddc5f8f11100c3d7d17c9 to your computer and use it in GitHub Desktop.
let alertController: UIAlertController = UIAlertController(title: "Pick an option", message: nil, preferredStyle: .actionSheet)
let cancelActionButton = UIAlertAction(title: "Cancel", style: .cancel) {
_ in
}
alertController.addAction(cancelActionButton)
let imageGalleryAction = UIAlertAction(title: "Choose from Gallery", style: .default)
{
[weak self] _ in
self?.pickVideo(from: UIImagePickerController.SourceType.photoLibrary)
}
alertController.addAction(imageGalleryAction)
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerController.SourceType.camera) {
let cameraAction = UIAlertAction(title: "Take a Video", style: .default)
{
[weak self]_ in
self?.pickVideo(from: UIImagePickerController.SourceType.camera)
}
alertController.addAction(cameraAction)
}
self.present(alertController, animated: true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment