A fully customisable and modern camera implementation for iOS made with AVFoundation.

Overview

Platform License Level

Custom Camera.


Features

  • Extremely simple and easy to use
  • Controls autofocus & exposure
  • Customizable interface
  • Code-made UI assets that do not lose resolution quality & resize dynamically depending on the screen size of the device.
  • Added animations to the UI elements for a more intuitive and responsive feel.
  • Overlays over any presented view controller or view
  • Made for iPhone & iPad

Installation

  • Include the AVFoundation.Framework library in your project, click on your project's target, navigate to Build Phases, then go to Link Binary With Libraries, click on the + and add the AVFoundation.Framework.
  • Browse to the directory of the demo app and drag the CustomizableCamera folder into your Xcode project.
  • import "CameraSessionView.h" to the view controller that will invoke the camera.

Usage

Using CustomizableCamera in your app is very fast and simple.

Displaying the camera view and adopting its delegate

After importing the "CameraSessionView.h" into the view controller, adopt its <CACameraSessionDelegate> delegate.

Next, declare a CameraSessionView property:

@property (nonatomic, strong) CameraSessionView *cameraView;

Now in the place where you would like to invoke the camera view (on the action of a button or viewDidLoad) instantiate it, set it's delegate and add it as a subview:

_cameraView = [[CameraSessionView alloc] initWithFrame:self.view.frame];
_cameraView.delegate = self;
[self.view addSubview:_cameraView];

Now implement one of this two delegate functions depending on whether you would like to get back a UIImage or NSData for an image when the shutter on the camera is pressed,

For a UIImage:

-(void)didCaptureImage:(UIImage *)image {
  //Use the image that is received
}

For NSData:

-(void)didCaptureImageWithData:(NSData *)imageData {
  //Use the image's data that is received
}

Dismissing the camera view

You can hide the camera view either by pressing the dismiss button on it or by writing [self.cameraView removeFromSuperview]; on the invoking view controller (it can be written inside one of the two delegate functions in order to dismiss it after taking a photo).

Customization

Once you have your CameraSessionView instance you can customize the appearance of the camera using its api, below are some samples:

To change the color of the top bar including its transparency:

[_cameraView setTopBarColor:[UIColor colorWithRed:0.97 green:0.97 blue:0.97 alpha: 0.64]];

To hide the flash button:

[_cameraView hideFlashButton]; //On iPad flash is not present, hence it wont appear.

To hide the switch camera's button:

[_cameraView hideCameraToogleButton];

To hide the dismiss button:

[_cameraView hideDismissButton];

If no customization is made, the camera view will use its default look.

Example

You can find a full example on usage and customization on the Xcode project attached to this repository.

Contributor

  • Christopher Cohen

License

The MIT License (MIT)

Copyright (c) 2015 Gabriel Alvarado ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Comments
  • Open Camera on Start Up

    Open Camera on Start Up

    Hello,

    I was wondering if you could show me how to make the camera launch when you first open the app instead of pushing a button to make it come on.

    Thanks!

    opened by gkrizek 4
  • Swift 1.2 not compatible

    Swift 1.2 not compatible

    I just updated XCode, and with Swift 1.2 I get this error:

    'Int' is not convertible to 'ObjCBool' 'Int' is not convertible to 'ObjCBool'

    :( Help is much appriciated! skjermbilde 2015-04-09 kl 18 49 11

    opened by enstulen 3
  • Launch in tab navigation view

    Launch in tab navigation view

    Is it possible to have this launch over a tab view. When I launch it now the tab controller at the bottom and top navigation bar overlay the camera. Thanks!

    question 
    opened by choiway 2
  • Crash on iOS 7

    Crash on iOS 7

    As I know it support only ios 8 but I want to use it on ios7 too but it is crashing on ios7 I have changed the minimum ios version to ios 7 too. Kindly help me on this issues

    opened by mwaqasbhati 2
  • Mach Linking Error with arm64 in Xcode 7 iOS 9 and swift 2.0

    Mach Linking Error with arm64 in Xcode 7 iOS 9 and swift 2.0

    Hello, I have created a new swift project and am trying to integrate your library into it. Everything seems to be working fine with creating the bridging header and instantiating the camera in a view controller. I followed your instructions and linked the AVFoundation.framework. However I keep getting this build error:

    Undefined symbols for architecture arm64: "_OBJC_CLASS_$_CameraSessionView", referenced from: type metadata accessor for __ObjC.CameraSessionView in CameraViewController.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

    Please let me know if this is an error in something that I have done trying to set this up. Thanks in advance.

    opened by n8stowell82 1
  • Spelling Corrections (toogle to toggle, loose to lose, thats to that)

    Spelling Corrections (toogle to toggle, loose to lose, thats to that)

    Hi Gabriel. Thanks for this amazing plugin. It looks like you have 3 spelling mistakes, and it'd make it just a tiny bit better if they were fixed (pretty minimal though).

    1. In the readme, 'loose' ("...do not loose resolution quality...") should be 'lose'.
    2. In the readme, 'thats' ("...implementation thats is...") should be 'that'.
    3. It should be a 'toggle', not a 'toogle' button; ex: calling [_cameraView hideToogleButton] should be changed to [_cameraView hideToggleButton]. This issue however, is actually repeated in the code, and so not just a readme change.

    Don't think I'm nitpicking, I just want to give back a little of my time, and this was what caught my eye.

    Cheers, Michael

    opened by michaellee1 1
  • Capture to 4:3

    Capture to 4:3

    Hi Gabriel, great library! We will be switching our current uiimagepicker to your library!

    We won't be using captureSession.sessionPreset = AVCaptureSessionPresetPhoto as we find the default preset perform better but in the past we struggle with getting a final image to match exactly what's on the preview screen as the preview screen is slightly zoomed in.

    Would appreciate if you can guide us on how to capture a 4:3 ratio image where the preview screen starts from the very top. (We have an overlay covering the bottom half so our preview screen will be 4:3). The captured image needs to be exactly what we see on the preview screen.

    Appreciate your help and we'll add an acknowledge to your your super cool library in our app!

    opened by milsirhc 1
  • Capture to square

    Capture to square

    Hi guys,

    can you help me? I am using your extension. I set cameraView frame to square. But when I capture image I have normal rectangle(full photo). How can I fix it?

    Thank you

    question 
    opened by Pades9 1
  • Take photo in square, record a video, zoom in/out ???

    Take photo in square, record a video, zoom in/out ???

    1. The library is taking photo in fullscreen. Can this library to take photo in square mode?
    2. Is this library able to record a video?
    3. it cannot zoom in/out the photo before taking ?

    If your library can implement these above issues, it will be more great. Anyway, thanks for your great library :)

    opened by HTKT 1
  • Fix broken headings in Markdown files

    Fix broken headings in Markdown files

    GitHub changed the way Markdown headings are parsed, so this change fixes it.

    See bryant1410/readmesfix for more information.

    Tackles bryant1410/readmesfix#1

    opened by bryant1410 0
  • Deprecation in iOS 10+

    Deprecation in iOS 10+

    This library need to be updated. Cause I face some warnings like: "'AVCaptureStillImageOutput' is deprecated: first deprecated in iOS 10.0 - Use AVCapturePhotoOutput instead."

    This library is used in my project. Please update it.

    opened by AnamikaDeb 0
  • Camera is Little bit zoomed

    Camera is Little bit zoomed

    Hello @GabrielAlva , Thanks for this library but I am facing the issue during capturing. when I launch the app I feel that camera is little bit zoomed. I have rechecked with iPhone's native camera also. Can you please help me to resolve this?

    opened by NileshKalathiya 0
  • iOS 10+ support

    iOS 10+ support

    Could you please, update your library?

    AVCaptureStillImageOutput is deprecated: Use AVCapturePhotoOutput instead AVCaptureDevice.devices is deprecated: Use AVCaptureDeviceDiscoverySession instead

    opened by evgeniybaranov 1
  • I am using this project in my app (swift)

    I am using this project in my app (swift)

    Just wanted to let you know.

    I previously used another one which was far too buggy. This one is simple, clean and does what it needs to do.

    https://itunes.apple.com/us/app/ocr-scan-text-from-camera/id1163617952?ls=1&mt=8

    Also for swift users looking for podspec.

    its easy to manually import this. Just follow the guide and add this to briding-header #import "./CustomizableCamera/Camera View/CameraSessionView.h"

    opened by San-Jeevan 1
Owner
Gabriel Alvarado
Gabriel Alvarado
Camera engine for iOS, written in Swift, above AVFoundation. :monkey:

?? The most advanced Camera framework in Swift ?? CameraEngine is an iOS camera engine library that allows easy integration of special capture feature

Remi ROBERT 575 Aug 30, 2022
A camera app we will dive deep into AVFoundation library

Camera App In this project you are going to discover few concepts in Swift that I've been working on for few weeks, Core Animations with CAShape Layer

Dheeraj Kumar Sharma 12 Nov 13, 2022
Library for iOS Camera API. CameraKit helps you add reliable camera to your app quickly.

CameraKit helps you add reliable camera to your app quickly. Our open source camera platform provides consistent capture results, service that scales, and endless camera possibilities.

CameraKit 627 Nov 7, 2022
BarcodeScanner is a simple and beautiful wrapper around the camera with barcode capturing functionality and a great user experience.

Description BarcodeScanner is a simple and beautiful wrapper around the camera with barcode capturing functionality and a great user experience. Barco

HyperRedink 1.6k Nov 17, 2022
NextLevel is a Swift camera system designed for easy integration, customized media capture, and image streaming in iOS

NextLevel is a Swift camera system designed for easy integration, customized media capture, and image streaming in iOS. Integration can optionally leverage AVFoundation or ARKit.

NextLevel 2k Nov 15, 2022
Fasttt and easy camera framework for iOS with customizable filters

FastttCamera is a wrapper around AVFoundation that allows you to build your own powerful custom camera app without all the headaches of using AVFounda

IFTTT 1.8k Nov 17, 2022
Video and photo camera for iOS

Features: Description Records video ?? takes photos ?? Flash on/off ⚡ Front / Back camera ↕️ Hold to record video ✊ Tap to take photo ?? Tap to focus

André J 191 Nov 19, 2022
An iOS framework that uses the front camera, detects your face and takes a selfie.

TakeASelfie An iOS framework that uses the front camera, detects your face and takes a selfie. This api opens the front camera and draws an green oval

Abdullah Selek 36 Aug 18, 2022
ALCameraViewController - A camera view controller with custom image picker and image cropping.

ALCameraViewController A camera view controller with custom image picker and image cropping. Features Front facing and rear facing camera Simple and c

Alex Littlejohn 2k Nov 6, 2022
Instagram-like photo browser and a camera feature with a few line of code in Swift.

Fusuma is a Swift library that provides an Instagram-like photo browser with a camera feature using only a few lines of code.

Yuta Akizuki 2.4k Nov 16, 2022
This plugin defines a global navigator.camera object, which provides an API for taking pictures and for choosing images from the system's image library.

title description Camera Take pictures with the device camera. AppVeyor Travis CI cordova-plugin-camera This plugin defines a global navigator.camera

null 0 Nov 2, 2021
A camera designed in Swift for easily integrating CoreML models - as well as image streaming, QR/Barcode detection, and many other features

Would you like to use a fully-functional camera in an iOS application in seconds? Would you like to do CoreML image recognition in just a few more sec

David Okun 863 Nov 15, 2022
iOS camera engine with Vine-like tap to record, animatable filters, slow motion, segments editing

SCRecorder A Vine/Instagram like audio/video recorder and filter framework in Objective-C. In short, here is a short list of the cool things you can d

Simon Corsin 3.1k Nov 17, 2022
A simple, customizable camera control - video recorder for iOS.

LLSimpleCamera: A simple customizable camera - video recorder control LLSimpleCamera is a library for creating a customized camera - video recorder sc

Ömer Faruk Gül 1.2k Nov 17, 2022
A light weight & simple & easy camera for iOS by Swift.

DKCamera Description A light weight & simple & easy camera for iOS by Swift. It uses CoreMotion framework to detect device orientation, so the screen-

Bannings 86 Aug 18, 2022
A Snapchat Inspired iOS Camera Framework written in Swift

Overview SwiftyCam is a a simple, Snapchat-style iOS Camera framework for easy photo and video capture. SwiftyCam allows users to capture both photos

Andrew Walz 1.9k Nov 16, 2022
UIView+CameraBackground - Show camera layer as a background to any UIView.

UIView+CameraBackground Show camera layer as a background to any UIView. Features Both front and back camera supported. Flash modes: auto, on, off. Co

Yonat Sharon 63 Nov 15, 2022
Simple Swift class to provide all the configurations you need to create custom camera view in your app

Camera Manager This is a simple Swift class to provide all the configurations you need to create custom camera view in your app. It follows orientatio

Imaginary Cloud 1.3k Nov 15, 2022
Mock UIImagePickerController for testing camera based UI in simulator

Mock UIImagePickerController to simulate the camera in iOS simulator.

Yonat Sharon 18 Aug 18, 2022