UIImagePickerController in Swift
In this article, we will UIImagePickerController to get image from camera or gallery by following three simple steps:
Lets start,
Step 1 : Add ImagePickerManager
Create a swift file and add the below code and save in your project. We are creating a new swift file because we want our view controller clean.
Step 2: Add permission in Plist
Now add both Camera and Library permission in Plist as showing below.
Step 3: Use ImagePickerManager
Now you can select image from camera and gallery by using single line of code.
ImagePickerManager().pickImage(self){ image in
}
Hope you enjoyed reading this post!!
If you have any comment, question, or recommendation, feel free to post them in the comment section below!
Thank you!!! Happy coding.