custom square camera like instagram and vimeo for iOS

This is a square camera like instagram and vimeo, you can customize it easily by setting frame of camera view, you can make it, square
,rectangular and full screen camera by setting camera view frame. If you want to use runtime filter that visible to preview on camera you can easily add this features.

How to use-

  • Implements CustomCameraDelegate methods.
  • Create object of custom camera controller and add it as a child controller in your view controller.

Below are the sample code-



//  ViewController.swift

//  SquareCamera


//  Created by on 13/03/19.

//  Copyright © 2019 All rights reserved.


import UIKit

class ViewController: UIViewController,CustomCameraDelegate {

    var  cameraController:CustomCameraController!

    func capturedOutput(_ output: AVCapturePhotoOutput!, finishProcessingPhoto photo: AVCapturePhoto!, error: Error!) {




    func didCompletedProcessingPhoto(_ image: UIImage!) {

        cameraController.saveImage(toGallery: image)



    func videoCaptured(with videoUrl: URL!) {




    func assetsWriterFailedToWriteVideoWithError(_ error: Error!) {




    @IBOutlet weak var containerView:UIView!


    override func viewDidLoad() {


        let childViewFrame = CGRect(origin: CGPoint(x: 0, y:0), size: CGSize(width: containerView.bounds.width, height: containerView.bounds.height))

        cameraController = CustomCameraController(nibName: "CustomCameraController", bundle: nil) as CustomCameraController

        cameraController.previewCaptureFrame = childViewFrame;

        cameraController.view.frame = childViewFrame

        cameraController.delegate = self



        cameraController.didMove(toParent: self)

        cameraController.delegate = self



    override func viewWillAppear(_ animated: Bool) {







0 Comment(s)

Leave a comment

Back to Top