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

Commit f954573

Browse files
Merge branch 'release/3.0.0'
2 parents 96fac14 + 441b9cc commit f954573

File tree

12 files changed

+47
-44
lines changed

12 files changed

+47
-44
lines changed

ALCameraViewController.podspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = "ALCameraViewController"
3-
spec.version = "2.0.3"
3+
spec.version = "3.0.0"
44
spec.summary = "A camera view controller with custom image picker and image cropping."
55
spec.source = { :git => "https://github.com/AlexLittlejohn/ALCameraViewController.git", :tag => spec.version.to_s }
66
spec.requires_arc = true
@@ -10,4 +10,5 @@ Pod::Spec.new do |spec|
1010
spec.resources = ["ALCameraViewController/ViewController/ConfirmViewController.xib", "ALCameraViewController/CameraViewAssets.xcassets", "ALCameraViewController/CameraView.strings"]
1111
spec.homepage = "https://github.com/AlexLittlejohn/ALCameraViewController"
1212
spec.author = { "Alex Littlejohn" => "alexlittlejohn@me.com" }
13+
spec.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.0' }
1314
end

ALCameraViewController.xcodeproj/project.pbxproj

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,12 @@
276276
TargetAttributes = {
277277
C4829FFA1CAEB16C00541D08 = {
278278
CreatedOnToolsVersion = 7.3;
279-
LastSwiftMigration = 0800;
279+
LastSwiftMigration = 0900;
280280
};
281281
FAF0583E1B31618D008E5592 = {
282282
CreatedOnToolsVersion = 6.3.2;
283-
DevelopmentTeam = GAPQH4AM76;
284-
LastSwiftMigration = 0800;
283+
DevelopmentTeam = 2466624KEK;
284+
LastSwiftMigration = 0900;
285285
ProvisioningStyle = Automatic;
286286
};
287287
};
@@ -407,7 +407,8 @@
407407
PRODUCT_BUNDLE_IDENTIFIER = com.zero.CameraViewController;
408408
PRODUCT_NAME = "$(TARGET_NAME)";
409409
SKIP_INSTALL = YES;
410-
SWIFT_VERSION = 3.0;
410+
SWIFT_SWIFT3_OBJC_INFERENCE = On;
411+
SWIFT_VERSION = 4.0;
411412
VERSIONING_SYSTEM = "apple-generic";
412413
VERSION_INFO_PREFIX = "";
413414
};
@@ -430,7 +431,8 @@
430431
PRODUCT_BUNDLE_IDENTIFIER = com.zero.CameraViewController;
431432
PRODUCT_NAME = "$(TARGET_NAME)";
432433
SKIP_INSTALL = YES;
433-
SWIFT_VERSION = 3.0;
434+
SWIFT_SWIFT3_OBJC_INFERENCE = On;
435+
SWIFT_VERSION = 4.0;
434436
VERSIONING_SYSTEM = "apple-generic";
435437
VERSION_INFO_PREFIX = "";
436438
};
@@ -543,13 +545,14 @@
543545
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
544546
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
545547
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
546-
DEVELOPMENT_TEAM = GAPQH4AM76;
548+
DEVELOPMENT_TEAM = 2466624KEK;
547549
INFOPLIST_FILE = "Example/Supporting Files/Info.plist";
548550
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
549551
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
550-
PRODUCT_BUNDLE_IDENTIFIER = com.zero.CameraViewController;
552+
PRODUCT_BUNDLE_IDENTIFIER = com.alx.zero.CameraViewController;
551553
PRODUCT_NAME = "$(TARGET_NAME)";
552-
SWIFT_VERSION = 3.0;
554+
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
555+
SWIFT_VERSION = 4.0;
553556
};
554557
name = Debug;
555558
};
@@ -559,13 +562,14 @@
559562
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
560563
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
561564
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
562-
DEVELOPMENT_TEAM = GAPQH4AM76;
565+
DEVELOPMENT_TEAM = 2466624KEK;
563566
INFOPLIST_FILE = "Example/Supporting Files/Info.plist";
564567
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
565568
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
566-
PRODUCT_BUNDLE_IDENTIFIER = com.zero.CameraViewController;
569+
PRODUCT_BUNDLE_IDENTIFIER = com.alx.zero.CameraViewController;
567570
PRODUCT_NAME = "$(TARGET_NAME)";
568-
SWIFT_VERSION = 3.0;
571+
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
572+
SWIFT_VERSION = 4.0;
569573
};
570574
name = Release;
571575
};

ALCameraViewController/Utilities/CameraGlobals.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ public class CameraGlobals {
2020
public var bundle = Bundle(for: CameraViewController.self)
2121
public var stringsTable = "CameraView"
2222
public var photoLibraryThumbnailSize = CGSize(width: thumbnailDimension, height: thumbnailDimension)
23-
public var defaultCameraPosition = AVCaptureDevicePosition.back
23+
public var defaultCameraPosition = AVCaptureDevice.Position.back
2424
}

ALCameraViewController/Utilities/CameraShot.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import AVFoundation
1111

1212
public typealias CameraShotCompletion = (UIImage?) -> Void
1313

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

16-
guard let videoConnection: AVCaptureConnection = stillImageOutput.connection(withMediaType: AVMediaTypeVideo) else {
16+
guard let videoConnection: AVCaptureConnection = stillImageOutput.connection(with: AVMediaType.video) else {
1717
completion(nil)
1818
return
1919
}

ALCameraViewController/Utilities/UIButtonExtensions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ extension UIButton {
4343
}
4444
}
4545

46-
func performAction() {
46+
@objc func performAction() {
4747
guard let action = action else {
4848
return
4949
}

ALCameraViewController/Utilities/Utilities.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ internal func normalizedRect(_ rect: CGRect, orientation: UIImageOrientation) ->
9191
return normalizedRect
9292
}
9393

94-
internal func flashImage(_ mode: AVCaptureFlashMode) -> String {
94+
internal func flashImage(_ mode: AVCaptureDevice.FlashMode) -> String {
9595
let image: String
9696
switch mode {
9797
case .auto:

ALCameraViewController/ViewController/CameraViewController.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ open class CameraViewController: UIViewController {
352352
object: nil)
353353
}
354354

355-
internal func notifyCameraReady() {
355+
@objc internal func notifyCameraReady() {
356356
cameraButton.isEnabled = true
357357
}
358358

@@ -391,7 +391,7 @@ open class CameraViewController: UIViewController {
391391
libraryButton].forEach({ $0.isEnabled = enabled })
392392
}
393393

394-
func rotateCameraView() {
394+
@objc func rotateCameraView() {
395395
cameraView.rotatePreview()
396396
}
397397

@@ -459,8 +459,8 @@ open class CameraViewController: UIViewController {
459459
* the user that it not allow the permissions.
460460
*/
461461
private func checkPermissions() {
462-
if AVCaptureDevice.authorizationStatus(forMediaType: AVMediaTypeVideo) != .authorized {
463-
AVCaptureDevice.requestAccess(forMediaType: AVMediaTypeVideo) { granted in
462+
if AVCaptureDevice.authorizationStatus(for: AVMediaType.video) != .authorized {
463+
AVCaptureDevice.requestAccess(for: AVMediaType.video) { granted in
464464
DispatchQueue.main.async() { [weak self] in
465465
if !granted {
466466
self?.showNoPermissionsView()
@@ -498,7 +498,7 @@ open class CameraViewController: UIViewController {
498498
*/
499499
internal func capturePhoto() {
500500
guard let output = cameraView.imageOutput,
501-
let connection = output.connection(withMediaType: AVMediaTypeVideo) else {
501+
let connection = output.connection(with: AVMediaType.video) else {
502502
return
503503
}
504504

@@ -577,7 +577,7 @@ open class CameraViewController: UIViewController {
577577

578578
internal func swapCamera() {
579579
cameraView.swapCameraInput()
580-
flashButton.isHidden = cameraView.currentPosition == AVCaptureDevicePosition.front
580+
flashButton.isHidden = cameraView.currentPosition == AVCaptureDevice.Position.front
581581
}
582582

583583
internal func layoutCameraResult(uiImage: UIImage) {

ALCameraViewController/ViewController/PhotoLibraryViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public class PhotoLibraryViewController: UIViewController {
7272
inViewController.present(navigationController, animated: animated, completion: nil)
7373
}
7474

75-
public func dismissLibrary() {
75+
@objc public func dismissLibrary() {
7676
onSelectionComplete?(nil)
7777
}
7878

ALCameraViewController/Views/CameraView.swift

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class CameraView: UIView {
2525

2626
public func startSession() {
2727
session = AVCaptureSession()
28-
session.sessionPreset = AVCaptureSessionPresetPhoto
28+
session.sessionPreset = AVCaptureSession.Preset.photo
2929

3030
device = cameraWithPosition(position: currentPosition)
3131
if let device = device , device.hasFlash {
@@ -107,7 +107,7 @@ public class CameraView: UIView {
107107
addGestureRecognizer(pinchGesture)
108108
}
109109

110-
internal func focus(gesture: UITapGestureRecognizer) {
110+
@objc internal func focus(gesture: UITapGestureRecognizer) {
111111
let point = gesture.location(in: self)
112112

113113
guard focusCamera(toPoint: point) else {
@@ -141,7 +141,7 @@ public class CameraView: UIView {
141141
})
142142
}
143143

144-
internal func pinch(gesture: UIPinchGestureRecognizer) {
144+
@objc internal func pinch(gesture: UIPinchGestureRecognizer) {
145145
guard let device = device else { return }
146146

147147
// Return zoom value between the minimum and maximum zoom values
@@ -175,16 +175,14 @@ public class CameraView: UIView {
175175
private func createPreview() {
176176

177177
preview = AVCaptureVideoPreviewLayer(session: session)
178-
preview.videoGravity = AVLayerVideoGravityResizeAspectFill
178+
preview.videoGravity = AVLayerVideoGravity.resizeAspectFill
179179
preview.frame = bounds
180180

181181
layer.addSublayer(preview)
182182
}
183183

184-
private func cameraWithPosition(position: AVCaptureDevicePosition) -> AVCaptureDevice? {
185-
guard let devices = AVCaptureDevice.devices(withMediaType: AVMediaTypeVideo) as? [AVCaptureDevice] else {
186-
return nil
187-
}
184+
private func cameraWithPosition(position: AVCaptureDevice.Position) -> AVCaptureDevice? {
185+
let devices = AVCaptureDevice.devices(for: AVMediaType.video)
188186
return devices.filter { $0.position == position }.first
189187
}
190188

@@ -218,7 +216,7 @@ public class CameraView: UIView {
218216
return false
219217
}
220218

221-
let focusPoint = preview.captureDevicePointOfInterest(for: toPoint)
219+
let focusPoint = preview.captureDevicePointConverted(fromLayerPoint: toPoint)
222220

223221
device.focusPointOfInterest = focusPoint
224222
device.focusMode = .continuousAutoFocus
@@ -258,11 +256,11 @@ public class CameraView: UIView {
258256
session.beginConfiguration()
259257
session.removeInput(currentInput)
260258

261-
if currentInput.device.position == AVCaptureDevicePosition.back {
262-
currentPosition = AVCaptureDevicePosition.front
259+
if currentInput.device.position == AVCaptureDevice.Position.back {
260+
currentPosition = AVCaptureDevice.Position.front
263261
device = cameraWithPosition(position: currentPosition)
264262
} else {
265-
currentPosition = AVCaptureDevicePosition.back
263+
currentPosition = AVCaptureDevice.Position.back
266264
device = cameraWithPosition(position: currentPosition)
267265
}
268266

@@ -283,16 +281,16 @@ public class CameraView: UIView {
283281
}
284282
switch UIApplication.shared.statusBarOrientation {
285283
case .portrait:
286-
preview?.connection.videoOrientation = AVCaptureVideoOrientation.portrait
284+
preview?.connection?.videoOrientation = AVCaptureVideoOrientation.portrait
287285
break
288286
case .portraitUpsideDown:
289-
preview?.connection.videoOrientation = AVCaptureVideoOrientation.portraitUpsideDown
287+
preview?.connection?.videoOrientation = AVCaptureVideoOrientation.portraitUpsideDown
290288
break
291289
case .landscapeRight:
292-
preview?.connection.videoOrientation = AVCaptureVideoOrientation.landscapeRight
290+
preview?.connection?.videoOrientation = AVCaptureVideoOrientation.landscapeRight
293291
break
294292
case .landscapeLeft:
295-
preview?.connection.videoOrientation = AVCaptureVideoOrientation.landscapeLeft
293+
preview?.connection?.videoOrientation = AVCaptureVideoOrientation.landscapeLeft
296294
break
297295
default: break
298296
}

ALCameraViewController/Views/CropOverlay.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ internal class CropOverlay: UIView {
164164
return button
165165
}
166166

167-
func moveCropOverlay(gestureRecognizer: UIPanGestureRecognizer) {
167+
@objc func moveCropOverlay(gestureRecognizer: UIPanGestureRecognizer) {
168168
if isResizable, let button = gestureRecognizer.view as? UIButton {
169169
if gestureRecognizer.state == .began || gestureRecognizer.state == .changed {
170170
let translation = gestureRecognizer.translation(in: self)

0 commit comments

Comments
 (0)