Skip to content
Permalink
Browse files

Update classes prefix to `CKF`

Resolves #10
  • Loading branch information...
adrianmateoaea24 committed Feb 25, 2019
1 parent 663c1a9 commit 1656e2c92528a06e22f83de2dbdf4f7ede9251c8
@@ -7,16 +7,16 @@
objects = {

/* Begin PBXBuildFile section */
3A47096321F21173004F4B8D /* CKGridView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A47096221F21173004F4B8D /* CKGridView.swift */; };
3A4E8BCF21F8E8D600CAC6F2 /* CKUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A4E8BCE21F8E8D600CAC6F2 /* CKUtils.swift */; };
3A76E33D21E549B800C8461D /* CKSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A76E33C21E549B800C8461D /* CKSession.swift */; };
3A76E33F21E54AC000C8461D /* CKPhotoSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A76E33E21E54AC000C8461D /* CKPhotoSession.swift */; };
3AC2453521E62AD600785FB2 /* CKVideoSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AC2453421E62AD600785FB2 /* CKVideoSession.swift */; };
3A47096321F21173004F4B8D /* CKFGridView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A47096221F21173004F4B8D /* CKFGridView.swift */; };
3A4E8BCF21F8E8D600CAC6F2 /* CKFUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A4E8BCE21F8E8D600CAC6F2 /* CKFUtils.swift */; };
3A76E33D21E549B800C8461D /* CKFSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A76E33C21E549B800C8461D /* CKFSession.swift */; };
3A76E33F21E54AC000C8461D /* CKFPhotoSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A76E33E21E54AC000C8461D /* CKFPhotoSession.swift */; };
3AC2453521E62AD600785FB2 /* CKFVideoSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AC2453421E62AD600785FB2 /* CKFVideoSession.swift */; };
3AD9372B21E53B97006A8C86 /* CameraKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AD9372121E53B97006A8C86 /* CameraKit.framework */; };
3AD9373021E53B97006A8C86 /* CameraKitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AD9372F21E53B97006A8C86 /* CameraKitTests.swift */; };
3AD9373221E53B97006A8C86 /* CameraKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AD9372421E53B97006A8C86 /* CameraKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
3AD9375F21E53F81006A8C86 /* CKPreviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AD9375C21E53C61006A8C86 /* CKPreviewView.swift */; };
3ADDEE7921E75A4E00EEF063 /* CKError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ADDEE7821E75A4E00EEF063 /* CKError.swift */; };
3AD9375F21E53F81006A8C86 /* CKFPreviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AD9375C21E53C61006A8C86 /* CKFPreviewView.swift */; };
3ADDEE7921E75A4E00EEF063 /* CKFError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ADDEE7821E75A4E00EEF063 /* CKFError.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
@@ -30,19 +30,19 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
3A47096221F21173004F4B8D /* CKGridView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CKGridView.swift; sourceTree = "<group>"; };
3A4E8BCE21F8E8D600CAC6F2 /* CKUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CKUtils.swift; sourceTree = "<group>"; };
3A76E33C21E549B800C8461D /* CKSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CKSession.swift; sourceTree = "<group>"; };
3A76E33E21E54AC000C8461D /* CKPhotoSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CKPhotoSession.swift; sourceTree = "<group>"; };
3AC2453421E62AD600785FB2 /* CKVideoSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CKVideoSession.swift; sourceTree = "<group>"; };
3A47096221F21173004F4B8D /* CKFGridView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CKFGridView.swift; sourceTree = "<group>"; };
3A4E8BCE21F8E8D600CAC6F2 /* CKFUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CKFUtils.swift; sourceTree = "<group>"; };
3A76E33C21E549B800C8461D /* CKFSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CKFSession.swift; sourceTree = "<group>"; };
3A76E33E21E54AC000C8461D /* CKFPhotoSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CKFPhotoSession.swift; sourceTree = "<group>"; };
3AC2453421E62AD600785FB2 /* CKFVideoSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CKFVideoSession.swift; sourceTree = "<group>"; };
3AD9372121E53B97006A8C86 /* CameraKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CameraKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3AD9372421E53B97006A8C86 /* CameraKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CameraKit.h; sourceTree = "<group>"; };
3AD9372521E53B97006A8C86 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3AD9372A21E53B97006A8C86 /* CameraKitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CameraKitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
3AD9372F21E53B97006A8C86 /* CameraKitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraKitTests.swift; sourceTree = "<group>"; };
3AD9373121E53B97006A8C86 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3AD9375C21E53C61006A8C86 /* CKPreviewView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CKPreviewView.swift; sourceTree = "<group>"; };
3ADDEE7821E75A4E00EEF063 /* CKError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CKError.swift; sourceTree = "<group>"; };
3AD9375C21E53C61006A8C86 /* CKFPreviewView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CKFPreviewView.swift; sourceTree = "<group>"; };
3ADDEE7821E75A4E00EEF063 /* CKFError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CKFError.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
@@ -85,13 +85,13 @@
3AD9372321E53B97006A8C86 /* CameraKit */ = {
isa = PBXGroup;
children = (
3AD9375C21E53C61006A8C86 /* CKPreviewView.swift */,
3A47096221F21173004F4B8D /* CKGridView.swift */,
3A76E33C21E549B800C8461D /* CKSession.swift */,
3A76E33E21E54AC000C8461D /* CKPhotoSession.swift */,
3AC2453421E62AD600785FB2 /* CKVideoSession.swift */,
3ADDEE7821E75A4E00EEF063 /* CKError.swift */,
3A4E8BCE21F8E8D600CAC6F2 /* CKUtils.swift */,
3AD9375C21E53C61006A8C86 /* CKFPreviewView.swift */,
3A47096221F21173004F4B8D /* CKFGridView.swift */,
3A76E33C21E549B800C8461D /* CKFSession.swift */,
3A76E33E21E54AC000C8461D /* CKFPhotoSession.swift */,
3AC2453421E62AD600785FB2 /* CKFVideoSession.swift */,
3ADDEE7821E75A4E00EEF063 /* CKFError.swift */,
3A4E8BCE21F8E8D600CAC6F2 /* CKFUtils.swift */,
3AD9372421E53B97006A8C86 /* CameraKit.h */,
3AD9372521E53B97006A8C86 /* Info.plist */,
);
@@ -216,13 +216,13 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3AC2453521E62AD600785FB2 /* CKVideoSession.swift in Sources */,
3ADDEE7921E75A4E00EEF063 /* CKError.swift in Sources */,
3A76E33D21E549B800C8461D /* CKSession.swift in Sources */,
3AD9375F21E53F81006A8C86 /* CKPreviewView.swift in Sources */,
3A47096321F21173004F4B8D /* CKGridView.swift in Sources */,
3A4E8BCF21F8E8D600CAC6F2 /* CKUtils.swift in Sources */,
3A76E33F21E54AC000C8461D /* CKPhotoSession.swift in Sources */,
3AC2453521E62AD600785FB2 /* CKFVideoSession.swift in Sources */,
3ADDEE7921E75A4E00EEF063 /* CKFError.swift in Sources */,
3A76E33D21E549B800C8461D /* CKFSession.swift in Sources */,
3AD9375F21E53F81006A8C86 /* CKFPreviewView.swift in Sources */,
3A47096321F21173004F4B8D /* CKFGridView.swift in Sources */,
3A4E8BCF21F8E8D600CAC6F2 /* CKFUtils.swift in Sources */,
3A76E33F21E54AC000C8461D /* CKFPhotoSession.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -8,7 +8,7 @@
import Foundation

public enum CKError: Error {
public enum CKFError: Error {
case captureDeviceNotFound
case error(String)
}
@@ -8,7 +8,7 @@
import UIKit

@objc public class CKGridView: UIView {
@objc public class CKFGridView: UIView {

@objc public var color: UIColor = UIColor.white.withAlphaComponent(0.5) {
didSet {
@@ -9,7 +9,7 @@
import UIKit
import AVFoundation

extension CKSession.FlashMode {
extension CKFSession.FlashMode {

var captureFlashMode: AVCaptureDevice.FlashMode {
switch self {
@@ -20,7 +20,7 @@ extension CKSession.FlashMode {
}
}

@objc public class CKPhotoSession: CKSession, AVCapturePhotoCaptureDelegate, AVCaptureMetadataOutputObjectsDelegate {
@objc public class CKFPhotoSession: CKFSession, AVCapturePhotoCaptureDelegate, AVCaptureMetadataOutputObjectsDelegate {

@objc public enum CameraDetection: UInt {
case none, faces
@@ -29,7 +29,7 @@ extension CKSession.FlashMode {
@objc public var cameraPosition = CameraPosition.back {
didSet {
do {
let deviceInput = try CKSession.captureDeviceInput(type: self.cameraPosition.deviceType)
let deviceInput = try CKFSession.captureDeviceInput(type: self.cameraPosition.deviceType)
self.captureDeviceInput = deviceInput
} catch let error {
print(error.localizedDescription)
@@ -62,7 +62,7 @@ extension CKSession.FlashMode {
}
}

@objc public var flashMode = CKSession.FlashMode.off
@objc public var flashMode = CKFSession.FlashMode.off

var captureDeviceInput: AVCaptureDeviceInput? {
didSet {
@@ -147,7 +147,7 @@ extension CKSession.FlashMode {

if
self.resolution.width > 0, self.resolution.height > 0,
let format = CKSession.deviceInputFormat(input: deviceInput, width: Int(self.resolution.width), height: Int(self.resolution.height))
let format = CKFSession.deviceInputFormat(input: deviceInput, width: Int(self.resolution.width), height: Int(self.resolution.height))
{
deviceInput.device.activeFormat = format
} else {
@@ -187,7 +187,7 @@ extension CKSession.FlashMode {
}

guard let data = photo.fileDataRepresentation() else {
self.errorCallback(CKError.error("Cannot get photo file data representation"))
self.errorCallback(CKFError.error("Cannot get photo file data representation"))
return
}

@@ -209,7 +209,7 @@ extension CKSession.FlashMode {
let photoSampleBuffer = photoSampleBuffer, let previewPhotoSampleBuffer = previewPhotoSampleBuffer,
let data = AVCapturePhotoOutput.jpegPhotoDataRepresentation(forJPEGSampleBuffer: photoSampleBuffer, previewPhotoSampleBuffer: previewPhotoSampleBuffer) else
{
self.errorCallback(CKError.error("Cannot get photo file data representation"))
self.errorCallback(CKFError.error("Cannot get photo file data representation"))
return
}

@@ -218,13 +218,13 @@ extension CKSession.FlashMode {

private func processPhotoData(data: Data, resolvedSettings: AVCaptureResolvedPhotoSettings) {
guard let image = UIImage(data: data) else {
self.errorCallback(CKError.error("Cannot get photo"))
self.errorCallback(CKFError.error("Cannot get photo"))
return
}

if
self.resolution.width > 0, self.resolution.height > 0,
let transformedImage = CKUtils.cropAndScale(image, width: Int(self.resolution.width), height: Int(self.resolution.height))
let transformedImage = CKFUtils.cropAndScale(image, width: Int(self.resolution.width), height: Int(self.resolution.height))
{
self.captureCallback(transformedImage, resolvedSettings)
return
@@ -9,7 +9,7 @@
import UIKit
import AVFoundation

@objc public class CKPreviewView: UIView {
@objc public class CKFPreviewView: UIView {

private var lastScale: CGFloat = 1.0

@@ -23,7 +23,7 @@ import AVFoundation
}
}

@objc public var session: CKSession? {
@objc public var session: CKFSession? {
didSet {
oldValue?.stop()

@@ -36,7 +36,7 @@ import AVFoundation
}
}

@objc private(set) public var gridView: CKGridView? {
@objc private(set) public var gridView: CKFGridView? {
didSet {
oldValue?.removeFromSuperview()

@@ -53,7 +53,7 @@ import AVFoundation
}

if self.showGrid {
self.gridView = CKGridView(frame: self.bounds)
self.gridView = CKFGridView(frame: self.bounds)
} else {
self.gridView = nil
}
@@ -8,7 +8,7 @@
import AVFoundation

private extension CKSession.DeviceType {
private extension CKFSession.DeviceType {

var captureDeviceType: AVCaptureDevice.DeviceType {
switch self {
@@ -40,8 +40,8 @@ private extension CKSession.DeviceType {
}
}

extension CKSession.CameraPosition {
var deviceType: CKSession.DeviceType {
extension CKFSession.CameraPosition {
var deviceType: CKFSession.DeviceType {
switch self {
case .back:
return .backCamera
@@ -51,11 +51,11 @@ extension CKSession.CameraPosition {
}
}

@objc public protocol CKSessionDelegate: class {
@objc func didChangeValue(session: CKSession, value: Any, key: String)
@objc public protocol CKFSessionDelegate: class {
@objc func didChangeValue(session: CKFSession, value: Any, key: String)
}

@objc public class CKSession: NSObject {
@objc public class CKFSession: NSObject {

@objc public enum DeviceType: UInt {
case frontCamera, backCamera, microphone
@@ -76,7 +76,7 @@ extension CKSession.CameraPosition {

@objc public var zoom = 1.0

@objc public weak var delegate: CKSessionDelegate?
@objc public weak var delegate: CKFSessionDelegate?

@objc override init() {
self.session = AVCaptureSession()
@@ -105,7 +105,7 @@ extension CKSession.CameraPosition {
position: type.capturePosition)

guard let captureDevice = captureDevices.devices.first else {
throw CKError.captureDeviceNotFound
throw CKFError.captureDeviceNotFound
}

return try AVCaptureDeviceInput(device: captureDevice)
@@ -8,7 +8,7 @@
import UIKit

@objc public class CKUtils: NSObject {
@objc public class CKFUtils: NSObject {

@objc public static func cropAndScale(_ image: UIImage, width: Int, height: Int) -> UIImage? {
let fromRect = CGRect(x: 0, y: 0, width: image.size.height, height: image.size.width)
@@ -8,7 +8,7 @@
import AVFoundation

extension CKSession.FlashMode {
extension CKFSession.FlashMode {

var captureTorchMode: AVCaptureDevice.TorchMode {
switch self {
@@ -19,14 +19,14 @@ extension CKSession.FlashMode {
}
}

@objc public class CKVideoSession: CKSession, AVCaptureFileOutputRecordingDelegate {
@objc public class CKFVideoSession: CKFSession, AVCaptureFileOutputRecordingDelegate {

@objc public private(set) var isRecording = false

@objc public var cameraPosition = CameraPosition.back {
didSet {
do {
let deviceInput = try CKSession.captureDeviceInput(type: self.cameraPosition.deviceType)
let deviceInput = try CKFSession.captureDeviceInput(type: self.cameraPosition.deviceType)
self.captureDeviceInput = deviceInput
} catch let error {
print(error.localizedDescription)
@@ -66,7 +66,7 @@ extension CKSession.FlashMode {
}
}

@objc public var flashMode = CKSession.FlashMode.off {
@objc public var flashMode = CKFSession.FlashMode.off {
didSet {
guard let device = self.captureDeviceInput?.device else {
return
@@ -93,7 +93,7 @@ extension CKSession.FlashMode {
self.cameraPosition = position

do {
let microphoneInput = try CKSession.captureDeviceInput(type: .microphone)
let microphoneInput = try CKFSession.captureDeviceInput(type: .microphone)
self.session.addInput(microphoneInput)
} catch let error {
print(error.localizedDescription)
@@ -135,7 +135,7 @@ extension CKSession.FlashMode {
@objc public func setWidth(_ width: Int, height: Int, frameRate: Int) {
guard
let input = self.captureDeviceInput,
let format = CKSession.deviceInputFormat(input: input, width: width, height: height, frameRate: frameRate)
let format = CKFSession.deviceInputFormat(input: input, width: width, height: height, frameRate: frameRate)
else {
return
}
@@ -20,11 +20,11 @@ @implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];

CKPreviewView *previewView = [[CKPreviewView alloc] initWithFrame:self.view.bounds];
CKFPreviewView *previewView = [[CKFPreviewView alloc] initWithFrame:self.view.bounds];
previewView.previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
[self.view addSubview:previewView];

CKPhotoSession *session = [[CKPhotoSession alloc] initWithPosition:CameraPositionBack detection:CameraDetectionNone];
CKFPhotoSession *session = [[CKFPhotoSession alloc] initWithPosition:CameraPositionBack detection:CameraDetectionNone];
previewView.session = session;
}

@@ -21,7 +21,7 @@
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0UD-h8-yNR">
<rect key="frame" x="0.0" y="20" width="320" height="428"/>
<subviews>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WrD-in-aex" customClass="CKPreviewView" customModule="CameraKit">
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WrD-in-aex" customClass="CKFPreviewView" customModule="CameraKit">
<rect key="frame" x="0.0" y="0.5" width="320" height="427"/>
<color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
@@ -566,7 +566,7 @@
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="H5V-hZ-kXh">
<rect key="frame" x="0.0" y="20" width="320" height="548"/>
<subviews>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aD4-vr-3Ay" customClass="CKPreviewView" customModule="CameraKit">
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aD4-vr-3Ay" customClass="CKFPreviewView" customModule="CameraKit">
<rect key="frame" x="0.0" y="0.0" width="320" height="548"/>
<color key="backgroundColor" white="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
Oops, something went wrong.

0 comments on commit 1656e2c

Please sign in to comment.
You can’t perform that action at this time.