- July 11, 2025
- Mins Read
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:
In progress
SPM only support source code, which means it cannot include resources such as images.
DKCamera is available on CocoaPods. Simply add the following line to your podfile:
# For latest release in cocoapods
pod ‘DKCamera’
Please use the
1.2.11
tag. 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.
let camera = DKCamera()
camera.didCancel = {
print(“didCancel”)
self.dismiss(animated: true, completion: nil)
}
camera.didFinishCapturingImage = { (image: UIImage?, metadata: [AnyHashable : Any]?) in
print(“didFinishCapturingImage”)
self.dismiss(animated: true, completion: nil)
self.imageView?.image = image
}
self.present(camera, animated: true, completion: nil)
open var cameraOverlayView: UIView?
/// The flashModel will to be remembered to next use.
open var flashMode:AVCaptureFlashMode!
open class func isAvailable() -> Bool
/// Determines whether or not the rotation is enabled.
open var allowsRotate = false
/// set to NO to hide all standard camera UI. default is YES.
open var showsCameraControls = true
open var defaultCaptureDevice = DKCameraDeviceSourceType.rear
/// Photos will be tagged with the location where they are taken.
/// Must add the “Privacy – Location XXX” tag to your Info.plist.
open var containsGPSInMetadata = false
/// Notify the listener of the detected faces in the preview frame.
open var onFaceDetection: ((_ faces: [AVMetadataFaceObject]) -> Void)?
If you are going to add a full-screen view as cameraOverlayView
, maybe you should use the DKCameraPassthroughView
or its subclass that have overriden the hitTest
method in order to the event passes through to the expected view.
// DKCamera.swift
public class DKCameraPassthroughView: UIView {
public override func hitTest(point: CGPoint, withEvent event: UIEvent?) -> UIView? {
let hitTestingView = super.hitTest(point, withEvent: event)
return hitTestingView == self ? nil : hitTestingView
}
}
A SwiftUI View that emits confetti with user-defined shapes, images, and text.
A colour wheel made all in SwiftUI. There are 2 different colour wheels to choose from. The first main one ...
A color picker implementation with color wheel appearance written in plain SwiftUI. It is compatible with UIColor and NSColor.
This repository is no longer maintained. Here's why: with the release of iOS 16 SwiftUI now enables most of the ...