A swift library for quickly integrating a built in camera session into your app.
Installing with cocoapods
pod 'PhotographyKit'
Quick start
First start by creating a PhotographyKitDelegate, this will handle the result of any images being captured
extension CameraViewController: PhotographyKitDelegate {
func didCaptureImage(image: UIImage) {
imageView.image = image
}
func didStartRecordingVideo() {
print("Recording started...")
}
func didFinishRecordingVideo(url: URL) {
print("Finished recording video to \(url.absoluteString)")
}
func didFailRecordingVideo(error: Error) {
print("Failed recording video to \(url.absoluteString) with error: \(error.localizedDescription)")
}
}
Once you have your delegate setup, you can initialize your PhotographyKit object. The initializer takes 2 arguments:
do {
camera = try PhotographyKit(view: captureView, delegate: self, allowsVideo: true)
} catch let error {
showPhotographyKitError(error as? PhotographyKitError)
}
Once this is done you can toggle flash, switch cameras, take photos and record videos
try? camera.takePhoto()
try? camera.startVideoRecording(maxLength: 15)
camera.endVideoRecording
try? camera.switchCamera()
try? camera.toggleFlash(.auto)
link |
Stars: 0 |
Last commit: 51 weeks ago |
Full Changelog: https://github.com/appoly/PhotographyKit/compare/0.24...0.25
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics