Created
March 9, 2023 11:43
-
-
Save ulaganathan-PalaniVelayutham/ec9eda71f16ddc5f8f11100c3d7d17c9 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
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