Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Feature/orientationanimation-zoom-exif-errorhandling-scaling #241

Open
wants to merge 81 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
bcc4e6d
Add pinch to zoom
Aug 21, 2017
8e610cd
Remove project mods
Aug 21, 2017
8ead2ad
Fix camera aspect to fit instead of fill so that the initial camera p…
Aug 23, 2017
0b7d8b6
Add parameter to disable audio capture
Aug 23, 2017
e1c2034
Remove team info from project
Aug 23, 2017
e762d9b
WIP on both data and image passed back
Sep 11, 2017
e572406
Add imageData to preview vc
Sep 12, 2017
6a24f3c
Cleanup and hardcode scale for now
Sep 12, 2017
9c28999
Add outputscale parameter
Sep 13, 2017
30c1bac
Change example scale to 1/3
Sep 13, 2017
0ddaf8f
Add proper button spacing
Sep 14, 2017
75b840e
Add EXIF attachments
Oct 3, 2017
d9a128f
Fix camera close positioning
Oct 3, 2017
fe2a978
Add podfiles and update camerashot with WIP
Oct 5, 2017
3f580a9
Add podfile WIP
Oct 5, 2017
270ad9f
Fix threading crash, add mixpanel logging, guard against nil buffer
Oct 5, 2017
79dabff
Making mixpanel events prints for now
Oct 5, 2017
b470f24
Capture photo error data and exif data
Oct 6, 2017
5be0823
Exif data and error data passed up
Oct 6, 2017
f53a528
Add error data and exif data output from capture
Oct 6, 2017
4a7e7c3
Increment version
Cyclic Oct 6, 2017
e20de0e
Add completion handler code
Oct 6, 2017
2a8a42c
Increment build
Cyclic Oct 6, 2017
56a5e95
Build bump
Cyclic Oct 6, 2017
4075ef7
Linting and exif print cleanup
Oct 11, 2017
e9bad72
Linting cleanup
Oct 13, 2017
0d39932
WIP on orientation change implementation
Oct 13, 2017
38beb21
Update pod
Oct 18, 2017
cb77eae
Merge pull request #3 from Cyclic/feature/pinch-to-zoom-camera
Cyclic Oct 18, 2017
92eda1f
Merge pull request #1 from Cyclic/feature/orientation-fixes
Cyclic Oct 18, 2017
bc954da
Update branch reference
Oct 18, 2017
20358c3
Increment the pod version
Oct 18, 2017
ce5b033
Rotate camera view flash button
Oct 18, 2017
1ae9825
Supplementing with fixed orientation steps
Oct 18, 2017
43277b8
Add rotate swap button
Oct 18, 2017
a1146c6
Orientation flip the buttons
Oct 18, 2017
e61a505
Build bump
Oct 18, 2017
446fcfb
Merge pull request #4 from Cyclic/feature/orientation-fixed
Cyclic Oct 18, 2017
0c69951
Update pod to 10
Oct 18, 2017
496c93d
Remove comments
Oct 18, 2017
ed4762e
Bump the pod version
Oct 18, 2017
f5e3336
Update pod
Oct 18, 2017
75b1473
Remove dispatch queue and fix odd leaks from leaks checker
Oct 20, 2017
cb79c48
Merge pull request #5 from Cyclic/bugfix/leak-fixes
Cyclic Oct 20, 2017
f833a60
Build bump
Cyclic Oct 20, 2017
6eb88ee
Merge pull request #6 from Cyclic/build-bump
Cyclic Oct 20, 2017
9325012
Add swift 4 support
Nov 1, 2017
3124f40
Pod build bump
Nov 1, 2017
61d52eb
linting...
Nov 1, 2017
15b6001
Merge pull request #7 from Cyclic/xcode9-swift4
Cyclic Nov 1, 2017
cde43f1
1.14.0
Cyclic Nov 1, 2017
e190892
Merge branch 'develop' of https://github.com/AlexLittlejohn/ALCameraV…
Nov 2, 2017
e243cf4
Linting
Nov 2, 2017
f76980d
Zoom is configured with device updates
Nov 2, 2017
788a5c9
Remove team
Nov 2, 2017
9aa6e78
Put URL back for pod
Nov 2, 2017
b224442
Merge pull request #8 from Cyclic/feature/update-main
Cyclic Nov 2, 2017
b187255
Enable bitcode, update pods
Nov 2, 2017
a7d4472
Merge pull request #9 from Cyclic/feature/update-main
Cyclic Nov 2, 2017
b470f72
Podfile update
Nov 2, 2017
fccb02c
Merge branch 'feature/update-main' into develop
Nov 2, 2017
451635a
Disable bitcode, version bump, and remove provisioning profile
Nov 3, 2017
b20c678
iOS 10 target
Nov 3, 2017
c4cafd7
Build bump
Cyclic Nov 3, 2017
15876d1
Build bump
Cyclic Nov 3, 2017
4a97e2f
Add scaleFactor
Nov 3, 2017
c60c291
Merge branch 'feature/update-main' of https://github.com/Cyclic/ALCam…
Nov 3, 2017
84d0685
Merge branch 'feature/update-main' into develop
Nov 3, 2017
833c972
Because swift 4.0
Cyclic Nov 7, 2017
e45e36e
Merge branch 'develop' into feature/update-main
Nov 8, 2017
8fbea73
Merge branch 'develop' of https://github.com/AlexLittlejohn/ALCameraV…
Nov 8, 2017
b08905b
Go back to swift 3.2, remove unnecessary pods, small code changes to …
Nov 8, 2017
93cfc13
Remove signing identity for project and build bump
Nov 8, 2017
ce8df44
Disable bitcode
Nov 8, 2017
db90884
Remove obsoleted signatures
Nov 10, 2017
cf389bd
Fix positioning for X camera button and update to swift 4 so builds work
Nov 29, 2017
fb45bfe
Merge pull request #10 from Cyclic/feature/update-main
Cyclic Nov 29, 2017
9e2f654
Build bump
Cyclic Nov 29, 2017
330d162
Build bump
Cyclic Nov 29, 2017
a7eef63
Back to 4.0
Cyclic Nov 29, 2017
979a3aa
Back to 3.2
Cyclic Nov 29, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ALCameraViewController.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = "ALCameraViewController"
spec.version = "3.0.2"
spec.version = "3.0.5"
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
Expand All @@ -10,5 +10,5 @@ Pod::Spec.new do |spec|
spec.resources = ["ALCameraViewController/ViewController/ConfirmViewController.xib", "ALCameraViewController/CameraViewAssets.xcassets", "ALCameraViewController/CameraView.strings"]
spec.homepage = "https://github.com/AlexLittlejohn/ALCameraViewController"
spec.author = { "Alex Littlejohn" => "[email protected]" }
spec.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }
spec.pod_target_xcconfig = { 'SWIFT_VERSION' => '3.2' }
end
91 changes: 88 additions & 3 deletions ALCameraViewController.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
1D4BC6A7CE46F52C503BE81A /* Pods_ALCameraViewController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5EA3B6D5F07E9E32F0AF2A75 /* Pods_ALCameraViewController.framework */; };
1F3C56291F701CA7009667E9 /* CroppingParameters.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AC96FA11F5B5166003E53F4 /* CroppingParameters.swift */; };
7AC96FA21F5B5166003E53F4 /* CroppingParameters.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AC96FA11F5B5166003E53F4 /* CroppingParameters.swift */; };
7C6AF41F1FB340CA006CB4ED /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7C6AF41E1FB340CA006CB4ED /* LaunchScreen.xib */; };
Expand Down Expand Up @@ -61,6 +62,8 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
30992D3B789B4F8CA8705055 /* Pods-ALCameraViewController.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ALCameraViewController.release.xcconfig"; path = "Pods/Target Support Files/Pods-ALCameraViewController/Pods-ALCameraViewController.release.xcconfig"; sourceTree = "<group>"; };
5EA3B6D5F07E9E32F0AF2A75 /* Pods_ALCameraViewController.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ALCameraViewController.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7AC96FA11F5B5166003E53F4 /* CroppingParameters.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CroppingParameters.swift; sourceTree = "<group>"; };
7C6AF41E1FB340CA006CB4ED /* LaunchScreen.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = LaunchScreen.xib; sourceTree = "<group>"; };
C40665431C73A47C00EB9751 /* SingleImageSaver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SingleImageSaver.swift; sourceTree = "<group>"; };
Expand All @@ -73,6 +76,7 @@
C4829FFF1CAEB16C00541D08 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C4D9BA441CA7224B004F70F7 /* PhotoLibraryAuthorizer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoLibraryAuthorizer.swift; sourceTree = "<group>"; };
C4D9BA461CA73163004F70F7 /* UIButtonExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIButtonExtensions.swift; sourceTree = "<group>"; };
D4AD3E148CB26CAF275AC0AC /* Pods-ALCameraViewController.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ALCameraViewController.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ALCameraViewController/Pods-ALCameraViewController.debug.xcconfig"; sourceTree = "<group>"; };
EBF7829B1CB2C04300DE3E63 /* CameraViewControllerConstraint.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = CameraViewControllerConstraint.swift; sourceTree = "<group>"; tabWidth = 4; };
EBFE097C1CAF1D1A00A8C637 /* UIViewExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIViewExtensions.swift; sourceTree = "<group>"; };
FA52EE0A1B44129B00E16B6F /* ViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ViewController.xib; sourceTree = "<group>"; };
Expand Down Expand Up @@ -108,12 +112,22 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1D4BC6A7CE46F52C503BE81A /* Pods_ALCameraViewController.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
43256C8F415F4382CB1B01FE /* Pods */ = {
isa = PBXGroup;
children = (
D4AD3E148CB26CAF275AC0AC /* Pods-ALCameraViewController.debug.xcconfig */,
30992D3B789B4F8CA8705055 /* Pods-ALCameraViewController.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
};
C4829FFC1CAEB16C00541D08 /* CameraViewController */ = {
isa = PBXGroup;
children = (
Expand All @@ -123,6 +137,14 @@
path = CameraViewController;
sourceTree = "<group>";
};
FA87334AA8FE91546E22FE97 /* Frameworks */ = {
isa = PBXGroup;
children = (
5EA3B6D5F07E9E32F0AF2A75 /* Pods_ALCameraViewController.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
FAB50BEA1B413E41009905B9 /* ViewController */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -171,6 +193,8 @@
FAF058411B31618D008E5592 /* ALCameraViewController */,
C4829FFC1CAEB16C00541D08 /* CameraViewController */,
FAF058401B31618D008E5592 /* Products */,
43256C8F415F4382CB1B01FE /* Pods */,
FA87334AA8FE91546E22FE97 /* Frameworks */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -253,9 +277,12 @@
isa = PBXNativeTarget;
buildConfigurationList = FAF0585E1B31618D008E5592 /* Build configuration list for PBXNativeTarget "ALCameraViewController" */;
buildPhases = (
B7EE613AF2C8F9F3F680AD43 /* [CP] Check Pods Manifest.lock */,
FAF0583B1B31618D008E5592 /* Sources */,
FAF0583C1B31618D008E5592 /* Frameworks */,
FAF0583D1B31618D008E5592 /* Resources */,
18CD297EA4D45E5795E3F66F /* [CP] Embed Pods Frameworks */,
52854F814B04225D8FBC2683 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -283,7 +310,7 @@
};
FAF0583E1B31618D008E5592 = {
CreatedOnToolsVersion = 6.3.2;
DevelopmentTeam = 2466624KEK;
DevelopmentTeam = 4L5389GUUE;
LastSwiftMigration = 0900;
ProvisioningStyle = Automatic;
};
Expand Down Expand Up @@ -335,6 +362,60 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
18CD297EA4D45E5795E3F66F /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-ALCameraViewController/Pods-ALCameraViewController-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/ALCameraViewController/ALCameraViewController.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ALCameraViewController.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ALCameraViewController/Pods-ALCameraViewController-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
52854F814B04225D8FBC2683 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ALCameraViewController/Pods-ALCameraViewController-resources.sh\"\n";
showEnvVarsInLog = 0;
};
B7EE613AF2C8F9F3F680AD43 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-ALCameraViewController-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
C4829FF61CAEB16C00541D08 /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down Expand Up @@ -545,10 +626,12 @@
};
FAF0585F1B31618D008E5592 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = D4AD3E148CB26CAF275AC0AC /* Pods-ALCameraViewController.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = 2466624KEK;
DEVELOPMENT_TEAM = 4L5389GUUE;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Example/Supporting Files/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand All @@ -561,10 +644,12 @@
};
FAF058601B31618D008E5592 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 30992D3B789B4F8CA8705055 /* Pods-ALCameraViewController.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = 2466624KEK;
DEVELOPMENT_TEAM = 4L5389GUUE;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Example/Supporting Files/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//

//#import <Cordova/CDV.h>
4 changes: 2 additions & 2 deletions ALCameraViewController/Utilities/CameraGlobals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import AVFoundation

internal let itemSpacing: CGFloat = 1
internal let columns: CGFloat = 4
internal let thumbnailDimension = (UIScreen.main.bounds.width - ((columns * itemSpacing) - itemSpacing))/columns
internal let thumbnailDimension = (UIScreen.main.bounds.width - ((columns * itemSpacing) - itemSpacing)) / columns
internal let scale = UIScreen.main.scale

public class CameraGlobals {
public static let shared = CameraGlobals()

public var bundle = Bundle(for: CameraViewController.self)
public var stringsTable = "CameraView"
public var photoLibraryThumbnailSize = CGSize(width: thumbnailDimension, height: thumbnailDimension)
Expand Down
90 changes: 52 additions & 38 deletions ALCameraViewController/Utilities/CameraShot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,62 @@
import UIKit
import AVFoundation

public typealias CameraShotCompletion = (UIImage?) -> Void
public typealias CameraShotCompletion = (Data?, UIImage?, String?, String?) -> Void

public func takePhoto(_ stillImageOutput: AVCaptureStillImageOutput, videoOrientation: AVCaptureVideoOrientation, cameraPosition: AVCaptureDevice.Position, cropSize _: CGSize, outputScale: CGFloat, completion: @escaping CameraShotCompletion) {

public func takePhoto(_ stillImageOutput: AVCaptureStillImageOutput, videoOrientation: AVCaptureVideoOrientation, cameraPosition: AVCaptureDevice.Position, cropSize: CGSize, completion: @escaping CameraShotCompletion) {

guard let videoConnection: AVCaptureConnection = stillImageOutput.connection(with: AVMediaType.video) else {
completion(nil)
completion(nil, nil, nil, nil)
return
}

videoConnection.videoOrientation = videoOrientation

stillImageOutput.captureStillImageAsynchronously(from: videoConnection, completionHandler: { buffer, error in

guard let buffer = buffer,
let imageData = AVCaptureStillImageOutput.jpegStillImageNSDataRepresentation(buffer),
var image = UIImage(data: imageData) else {
completion(nil)
return
}

// flip the image to match the orientation of the preview
if cameraPosition == .front, let cgImage = image.cgImage {
switch image.imageOrientation {
case .leftMirrored:
image = UIImage(cgImage: cgImage, scale: image.scale, orientation: .right)
case .left:
image = UIImage(cgImage: cgImage, scale: image.scale, orientation: .rightMirrored)
case .rightMirrored:
image = UIImage(cgImage: cgImage, scale: image.scale, orientation: .left)
case .right:
image = UIImage(cgImage: cgImage, scale: image.scale, orientation: .leftMirrored)
case .up:
image = UIImage(cgImage: cgImage, scale: image.scale, orientation: .upMirrored)
case .upMirrored:
image = UIImage(cgImage: cgImage, scale: image.scale, orientation: .up)
case .down:
image = UIImage(cgImage: cgImage, scale: image.scale, orientation: .downMirrored)
case .downMirrored:
image = UIImage(cgImage: cgImage, scale: image.scale, orientation: .down)

if !stillImageOutput.isCapturingStillImage {
stillImageOutput.captureStillImageAsynchronously(from: videoConnection, completionHandler: { buffer, error in

if let error = error {
completion(nil, nil, "Error in image capture: \(error.localizedDescription)", nil)
}

guard let buffer = buffer,
let exifAttachments = CMGetAttachment(buffer, kCGImagePropertyExifDictionary, nil),
let imageData = AVCaptureStillImageOutput.jpegStillImageNSDataRepresentation(buffer),
var image = UIImage(data: imageData),
let cgImage = image.cgImage else {
DispatchQueue.main.async {
completion(nil, nil, "Error capture, NULL image buffer or NULL EXIF data", nil)
return
}
return
}

// flip the image to match the orientation of the preview
// Half size is large for now
if cameraPosition == .front {
switch image.imageOrientation {
case .leftMirrored:
image = UIImage(cgImage: cgImage, scale: outputScale, orientation: .right)
case .left:
image = UIImage(cgImage: cgImage, scale: outputScale, orientation: .rightMirrored)
case .rightMirrored:
image = UIImage(cgImage: cgImage, scale: outputScale, orientation: .left)
case .right:
image = UIImage(cgImage: cgImage, scale: outputScale, orientation: .leftMirrored)
case .up:
image = UIImage(cgImage: cgImage, scale: outputScale, orientation: .upMirrored)
case .upMirrored:
image = UIImage(cgImage: cgImage, scale: outputScale, orientation: .up)
case .down:
image = UIImage(cgImage: cgImage, scale: outputScale, orientation: .downMirrored)
case .downMirrored:
image = UIImage(cgImage: cgImage, scale: outputScale, orientation: .down)
}
} else {
image = UIImage(cgImage: cgImage, scale: outputScale, orientation: image.imageOrientation)
}
}
completion(image)
})
completion(imageData, image, nil, "EXIF \(exifAttachments)")

})
}
}
2 changes: 1 addition & 1 deletion ALCameraViewController/Utilities/CroppingParameters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public struct CroppingParameters {
public init(isEnabled: Bool = false,
allowResizing: Bool = true,
allowMoving: Bool = true,
minimumSize: CGSize = CGSize(width: 60, height: 60)) {
minimumSize: CGSize = CGSize(width: 60, height: 60)) {

self.isEnabled = isEnabled
self.allowResizing = allowResizing
Expand Down
26 changes: 13 additions & 13 deletions ALCameraViewController/Utilities/ImageFetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,37 @@
import UIKit
import Photos

public typealias ImageFetcherSuccess = (PHFetchResult<PHAsset>) -> ()
public typealias ImageFetcherFailure = (NSError) -> ()
public typealias ImageFetcherSuccess = (PHFetchResult<PHAsset>) -> Void
public typealias ImageFetcherFailure = (NSError) -> Void

//extension PHFetchResult: Sequence {
// extension PHFetchResult: Sequence {
// public func makeIterator() -> NSFastEnumerationIterator {
// return NSFastEnumerationIterator(self)
// }
//}
// }

public class ImageFetcher {

private var success: ImageFetcherSuccess?
private var failure: ImageFetcherFailure?

private var authRequested = false
private let errorDomain = "com.zero.imageFetcher"
let libraryQueue = DispatchQueue(label: "com.zero.ALCameraViewController.LibraryQueue");
public init() { }

let libraryQueue = DispatchQueue(label: "com.zero.ALCameraViewController.LibraryQueue")

public init() {}

public func onSuccess(_ success: @escaping ImageFetcherSuccess) -> Self {
self.success = success
return self
}

public func onFailure(_ failure: @escaping ImageFetcherFailure) -> Self {
self.failure = failure
return self
}

public func fetch() -> Self {
_ = PhotoLibraryAuthorizer { error in
if error == nil {
Expand All @@ -50,7 +50,7 @@ public class ImageFetcher {
}
return self
}

private func onAuthorized() {
let options = PHFetchOptions()
options.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)]
Expand Down
Loading