Skip to content

Commit 8770d7b

Browse files
author
Jelle Alten
committed
Mark old methods as deprecated
1 parent 8d3a8a7 commit 8770d7b

1 file changed

Lines changed: 44 additions & 1 deletion

File tree

camera/CameraManager.swift

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,29 @@ open class CameraManager: NSObject, AVCaptureFileOutputRecordingDelegate, UIGest
488488
self.movieOutput = nil
489489
self.animateCameraDeviceChange = oldAnimationValue
490490
}
491-
491+
492+
/**
493+
Captures still image from currently running capture session.
494+
495+
:param: imageCompletion Completion block containing the captured UIImage
496+
*/
497+
@available(*, deprecated)
498+
open func capturePictureWithCompletion(_ imageCompletion: @escaping (UIImage?, NSError?) -> Void) {
499+
500+
func completion(_ result: CaptureResult) {
501+
502+
switch result {
503+
504+
case let .success(content):
505+
imageCompletion(content.asImage, nil)
506+
case .failure:
507+
imageCompletion(nil, NSError())
508+
}
509+
}
510+
511+
capturePictureWithCompletion(completion)
512+
}
513+
492514
/**
493515
Captures still image from currently running capture session.
494516

@@ -631,6 +653,27 @@ open class CameraManager: NSObject, AVCaptureFileOutputRecordingDelegate, UIGest
631653
/**
632654
Captures still image from currently running capture session.
633655

656+
:param: imageCompletion Completion block containing the captured imageData
657+
*/
658+
@available(*, deprecated)
659+
open func capturePictureDataWithCompletion(_ imageCompletion: @escaping (Data?, NSError?) -> Void) {
660+
661+
func completion(_ result: CaptureResult) {
662+
663+
switch result {
664+
665+
case let .success(content):
666+
imageCompletion(content.asData, nil)
667+
case .failure:
668+
imageCompletion(nil, NSError())
669+
}
670+
}
671+
capturePictureDataWithCompletion(completion)
672+
}
673+
674+
/**
675+
Captures still image from currently running capture session.
676+
634677
:param: imageCompletion Completion block containing the captured imageData
635678
*/
636679
open func capturePictureDataWithCompletion(_ imageCompletion: @escaping (CaptureResult) -> Void) {

0 commit comments

Comments
 (0)