[![CI Status](http://img.shields.io/travis/Joey Lee/JLImagePicker.svg?style=flat)](https://travis-ci.org/Joey Lee/JLImagePicker)
To run the example project, clone the repo, and run pod install
from the Example directory first.
JLImagePicker is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "JLImagePicker"
Add privacy key-string pairs in Info.plist file for your target.
- Example
<key>NSCameraUsageDescription</key>
<string>This app requires access to the camera.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>
- Objective-C
#import <JLImagePicker/JLImagePicker.h>
[JLImagePicker takePhotoOnViewController:self.viewController
camera:JLImagePickerCameraFront
allowsEditing:YES
completion:^(BOOL success, UIImage *image, AVAuthorizationStatus authStatus) {
if(success) {
// do something with the image
}
else {
if(authStatus == AVAuthorizationStatusRestricted) {
// alert
}
else if(authStatus == AVAuthorizationStatusDenied) {
// alert + go to Settings app
}
}
}];
- Swift 4
import JLImagePicker
JLImagePicker.takePhoto(on: viewController, camera: .front, allowsEditing: true) { (success, image, authStatus) in
if success {
// do something with the image
}
else {
if authStatus == .restricted {
// alert
}
else if authStatus == .denied {
// alert + go to Settings app
}
}
}
Joey Lee, slarinz@gmail.com
JLImagePicker is available under the MIT license. See the LICENSE file for more info.