An in-app Camera compatible with iPhone and iPads.
To run the example project, clone the repo, and run pod install
from the Example directory first.
Cam is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod 'Cam', '1.0.0'
1) Import the library
import UIKit
import Cam
2) Create a Cam object
let camera = Cam()
3) Call Display
cam.display(on: self) { (photo) in
}
4) Process Photo
cam.display(on: self) { (photo) in
if let photo = photo {
// Example: displaying image on an imageview for 2 seconds
let imageView = UIImageView(frame: self.view.frame)
imageView.contentMode = .scaleAspectFit
imageView.image = photo.image
self.view.addSubview(imageView)
DispatchQueue.main.asyncAfter(deadline: .now() + 2, execute: {
imageView.removeFromSuperview()
})
}
}
amirshayegh, shayegh@me.com
Cam is available under the MIT license. See the LICENSE file for more info.