From 1396bc36b8c729b54e4de7baed9b123ad50a2297 Mon Sep 17 00:00:00 2001 From: Alex Littlejohn Date: Mon, 4 Sep 2017 10:20:04 +0200 Subject: [PATCH 1/4] Updated readme --- README.md | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5755a61e..b65c0f15 100644 --- a/README.md +++ b/README.md @@ -42,17 +42,45 @@ Add `import ALCameraViewController` to the top of you controller file. In the viewController ```swift -let croppingEnabled = true -let cameraViewController = CameraViewController(croppingEnabled: croppingEnabled) { [weak self] image, asset in +let cameraViewController = CameraViewController { [weak self] image, asset in // Do something with your image here. - // If cropping is enabled this image will be the cropped version - self?.dismiss(animated: true, completion: nil) } present(cameraViewController, animated: true, completion: nil) ``` +### Parameters + +There are a number of configurable options available for `CameraViewController` + +```swift +init(croppingParameters: CroppingParameters = CroppingParameters(), + allowsLibraryAccess: Bool = true, + allowsSwapCameraOrientation: Bool = true, + allowVolumeButtonCapture: Bool = true, + completion: @escaping CameraViewCompletion) +``` + +The Cropping Parameters struct accepts the following parameters + +```swift +init(isEnabled: Bool = false, + allowResizing: Bool = true, + allowMoving: Bool = true, + minimumSize: CGSize = CGSize(width: 60, height: 60)) +``` + +The success parameter returns a `UIImage?` and a `PHAsset?` for more advanced use cases. +If the user canceled photo capture ten both of these options will be `nil` + +```swift +typealias CameraViewCompletion = (UIImage?, PHAsset?) -> Void +``` +> Note: To prevent retain cycles, it is best to use a `[weak self]` reference within the success parameter + +### Other usage options + You can also instantiate the image picker component by itself as well. ```swift From 79a9d008e5ac7a44c9c60744272bc281274ed6f8 Mon Sep 17 00:00:00 2001 From: Alex Littlejohn Date: Wed, 6 Sep 2017 09:22:50 +0200 Subject: [PATCH 2/4] Apply camera rotation during view will appear to fix iPad issue --- ALCameraViewController/ViewController/CameraViewController.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/ALCameraViewController/ViewController/CameraViewController.swift b/ALCameraViewController/ViewController/CameraViewController.swift index f23d25bc..4bbdb644 100644 --- a/ALCameraViewController/ViewController/CameraViewController.swift +++ b/ALCameraViewController/ViewController/CameraViewController.swift @@ -284,6 +284,7 @@ open class CameraViewController: UIViewController { cameraView.startSession() addCameraObserver() addRotateObserver() + rotateCameraView() if allowVolumeButtonCapture { setupVolumeControl() From d66d9e23d6b796f575f95eb498f5d1541a0a8f05 Mon Sep 17 00:00:00 2001 From: Alex Littlejohn Date: Wed, 6 Sep 2017 09:28:17 +0200 Subject: [PATCH 3/4] update readme --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b65c0f15..a18fb7f2 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,13 @@ A camera view controller with custom image picker and image cropping. ### Features -- Front facing and rear facing camera support -- Simple and clean look -- Custom image picker with permission checking -- Image cropping (square only) -- Flash light support +- [x] Front facing and rear facing camera +- [x] Simple and clean look +- [x] Custom image picker with permission checking +- [x] Image cropping +- [x] Flash light +- [x] Zoom +- [x] Tap to focus ### Installation & Requirements This project requires Xcode 8.3 to run and compiles with swift 3.1 From 74ffab05be239ebea8f37c25d60ad4c9d565ebe1 Mon Sep 17 00:00:00 2001 From: Alex Littlejohn Date: Wed, 6 Sep 2017 09:28:34 +0200 Subject: [PATCH 4/4] v2.0.1 --- ALCameraViewController.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ALCameraViewController.podspec b/ALCameraViewController.podspec index ffedc4f6..58b45081 100644 --- a/ALCameraViewController.podspec +++ b/ALCameraViewController.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = "ALCameraViewController" - spec.version = "2.0.0" + spec.version = "2.0.1" spec.summary = "A camera view controller with custom image picker and image cropping." spec.source = { :git => "https://github.com/AlexLittlejohn/ALCameraViewController.git", :tag => spec.version.to_s } spec.requires_arc = true