Skip to content
This repository was archived by the owner on Jul 14, 2020. It is now read-only.
/ DKCamera Public archive
forked from zhangao0086/DKCamera

A light weight & simple & easy camera for iOS by Swift.

License

Notifications You must be signed in to change notification settings

ModernClimate/DKCamera

 
 

Repository files navigation

DKCamera

Build Status Version Status license MIT

Update for Xcode 7 with Swift 2.0

Description

A light weight & simple & easy camera for iOS by Swift. It uses CoreMotion framework to detect device orientation, so the screen-orientation lock will be ignored(Perfect orientation handling). And it has two other purposes:

  • Can be presenting or pushing or Integrating.
  • Suppressing the warning "Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates."(It seems a bug in iOS 8).

Requirements

  • iOS 7.1+
  • ARC

Installation

iOS 8 and newer

DKCamera is available on Cocoapods. Simply add the following line to your podfile:

# For latest release in cocoapods
pod 'DKCamera'

iOS 7.x

To use Swift libraries on apps that support iOS 7, you must manually copy the files into your application project. CocoaPods only supports Swift on OS X 10.9 and newer, and iOS 8 and newer.

Easy to use

let camera = DKCamera()

camera.didCancelled = { () in
    println("didCancelled")
    
    self.dismissViewControllerAnimated(true, completion: nil)
}

camera.didFinishCapturingImage = {(image: UIImage) in
    println("didFinishCapturingImage")
    
    self.dismissViewControllerAnimated(true, completion: nil)
    
    self.imageView?.image = image
}
self.presentViewController(camera, animated: true, completion: nil)

You also can use these APIs:

public var cameraOverlayView: UIView?

/// The flashModel will to be remembered to next use.
public var flashMode:AVCaptureFlashMode = .Auto

public class func isAvailable() -> Bool

License

DKCamera is released under the MIT license. See LICENSE for details.

About

A light weight & simple & easy camera for iOS by Swift.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 97.2%
  • Ruby 2.8%