JLImagePicker
[![CI Status](http://img.shields.io/travis/Joey Lee/JLImagePicker.svg?style=flat)](https://travis-ci.org/Joey Lee/JLImagePicker)
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
Installation
JLImagePicker is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "JLImagePicker"
Setting
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>
Usage
- 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
}
}
}
Author
Joey Lee, [email protected]
License
JLImagePicker is available under the MIT license. See the LICENSE file for more info.