How to Build a Camera App Using Custom Framework for iOS?

Since its first model, the iPhone has shipped with a camera. However, the only way to integrate the camera into an app by using its SDKs UIImagePickerController. With the introduction of the AVFoundation framework, iPhone app developers get more flexibility. In this how to build a camera app tutorial, we will see how one common module uses in different applications in iOS.

If we want to distribute that module to the social world and don’t want to reveal that logic behind it, then we need to create the framework of the code.

Here, we are going to create one simple custom camera implementation as the framework that we can use in any application to add different functionalities like shutter speed, video recording, slow-motion recording, a photo timer, and live filters. So, let’s get started.

Creating a Custom Camera App From Scratch

First of all, you need to create a project from scratch.

choose a template for your new project

Since Xcode 7, there is a built-in option or method to create a dynamic framework project as per the requirements. You should use this option or method if you need to create a framework project from scratch.

For further information on how we made this SDK/Framework for the custom camera, You can visit the below link:

# We hope that you already went through the framework portion. You have to generate a .framework file from building our code available at GitHub following the simple method or approach. Now, you have the framework file, so let’s start integration in the project.

Integrate the Framework in External App for Development

👉 Create a new project and drag socameraManager.framework into the root folder of your project. Then, go to your project target, click on the “build Settings” tab, and add “socameramanager.framework” to embed binaries in the app’s general setting.

Camera Manager in iOS
👉 Create UI/UX for a custom camera view controller.# Further, let’s see how to use a framework at the code level.
Main Storyboard
👉 ViewController.swift

import UIKit
import SOCameraManager

class ViewController: UIViewController {
// MARK: - Constants
let cameraManager = SOCameraManager()

override func viewDidLoad() {
// Do any additional setup after loading the view, typically from a nib.
cameraManager.showAccessPermissionPopupAutomatically = false

let currentCameraState = cameraManager.currentCameraStatus()
if currentCameraState == .NotDetermined {

} else if (currentCameraState == .Ready) {
if !cameraManager.hasFlash {
btnFlash.enabled = false
btnFlash.setTitle("On", forState: UIControlState.Normal)

override func viewWillAppear(animated: Bool) {
navigationController?.navigationBar.hidden = true

override func viewWillDisappear(animated: Bool) {

// MARK: - Add camera to view
private func addCameraToView() {
cameraManager.addPreviewLayerToView(cameraView, newCameraOutputMode: SOCameraOutputMode.StillImage)
cameraManager.showErrorBlock = { [weak self] (erTitle: String, erMessage: String) -> Void in

let alertController = UIAlertController(title: erTitle, message: erMessage, preferredStyle: .Alert)
alertController.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: { (alertAction) -> Void in }))
self?.presentViewController(alertController, animated: true, completion: nil)

// MARK: - Change Flash Mode
@IBAction func btnFlashClicekd(sender: AnyObject) {
switch (cameraManager.changeFlashMode()) {
case .Off:
sender.setTitle("Off", forState: UIControlState.Normal)
case .On:
sender.setTitle("On", forState: UIControlState.Normal)
case .Auto:
sender.setTitle("Auto", forState: UIControlState.Normal)
// MARK: - Camera capture photo
@IBAction func btnCaptureClicked(sender: AnyObject) {
cameraManager.capturePictureWithCompletition({ (image, error) -> Void in
let vc: ImageViewController? = self.storyboard?.instantiateViewControllerWithIdentifier("ImageVC") as? ImageViewController
if let validVC: ImageViewController = vc {
if let capturedImage = image {
validVC.image = capturedImage
self.navigationController?.pushViewController(validVC, animated: true)

// MARK: - Rotate camera front and back
@IBAction func btnCameraFlipClicked(sender: AnyObject) {

cameraManager.cameraDevice = cameraManager.cameraDevice == SOCameraDevice.Front ? SOCameraDevice.Back : SOCameraDevice.Front
switch (cameraManager.cameraDevice) {
case .Front:
sender.setTitle("Front", forState: UIControlState.Normal)
case .Back:
sender.setTitle("Back", forState: UIControlState.Normal)
// MARK: - Ask permission to user
@IBAction func askForCameraPermissions(sender: UIButton) {
cameraManager.askUserForCameraPermissions({ permissionGranted in
if permissionGranted {

Now that your camera application is ready, it’s time to press that photo button, take a photo, upload it to Instagram, and let everyone know how you created this simple camera app with an elegant user interface or user interaction.

We have used this simple custom camera implementation in many of our photo-video apps like TextOnPhoto, TextOnVideo, VideoEditor, Photoblur using a photo library. Our iPhone app development team has also used the same camera implementation in the SquareSized app to add functionality like posting an entire photo on Instagram with a single button. To get a view of the example, you can take a look at our photo and video app portfolio.

We have optimized SquareSized for iOS 9, iPhone 6s, and iPhone 6s Plus. Currently, this application is used by more than 5 million people worldwide to post photos on Instagram! We also have integrated features of adding borders on each side of the photos, editing videos, filters, text and shapes, and backgrounds.

Still, have general questions or queries in mind? Don’t worry, here are the answers to your questions.

Have a mobile app idea that you want to validate with experts?

Consult Our Experts Now


How do you make a camera application?

You can create a custom camera application with a custom camera framework by replicating the steps showcased here in this tutorial.

Which frameworks can be used for creating iOS apps?

A few of the top iOS app development frameworks include Ext JS, Ionic, React Native, JQuery Mobile, Flutter, and Xamarin. One can make use of these frameworks for developing advanced iPhone apps with unique features and functionalities.

What is the difference between the AV Foundation and Video Toolbox?

AVFoundation is used for creating, editing, and playing MPEG4 files. It can also be used for customizing your app with powerful media functionalities. However, when it comes to Video Toolbox, it uses the hardware’s encoding and decoding capabilities.


We hope this tutorial will help you build your own custom camera app for iOS. However, if you are seeking to create an enterprise-grade iOS application or have any other app idea in mind, let us help. Schedule a call with our tech consultants and they will guide your iOS app development all the way through until its successful completion.

Author Bio
Hitesh Trivedi
Hitesh Trivedi
Designation: iOS Team Lead

Hitesh Trivedi is an iOS Team Lead at Space-O Technologies. He has over 10 years of experience in iOS app development. He has guided to develop over 100 iPhone apps with unique features and functionalities. He has special expertise in Swift and Objective-C.