cristhianleonli / CameraView

Ready-to-use camera view component

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CameraView

Plug and Play camera view

Usage

import UIKit
import CameraView

class ViewController: UIViewController {
    
    var cameraView: CameraView?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        cameraView = CameraView(delegate: self, position: .front,
                                frame: CGRect(x: 50, y: 50, width: 100, height: 100))
        if let v = cameraView?.view {
            view.addSubview(v)
        }
    }
    
    @IBAction func openCamera(_ sender: Any) {
        cameraView?.start()
    }
}

extension ViewController: CameraViewDelegate {
    func onFrame(withCVImageBuffer buffer: CVPixelBuffer) {
        print(#line)
    }
    
    func onError(reason: CameraViewError) {
        print(reason)
    }
}

Setting up with Carthage

Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate DateAgo into your Xcode project using Carthage, specify it in your Cartfile: github "cristhianleonli/CameraView"

About

Ready-to-use camera view component


Languages

Language:Swift 93.3%Language:Objective-C 6.7%