Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Camera Manager, a simple Swift custom camera view

Ricardo Torrão

November 12, 2021

Min Read
Camera Manager, a simple Swift custom camera view

UIImagePickerController & AVCaptureSession

When it comes to building an app to take pictures and capture videos in iOS, Apple provides two different approaches: UIImagePickerController and AVCaptureSession.

UIImagePickerController is the easiest way to get up and running since you can have a working solution with a few lines of code. However, this simplicity comes at a cost: UI customization or adding functionalities to the camera (e.g., tap to focus) has its difficulties.

On the other hand, AVCaptureSession, part of the AVFoundation framework, enables more customization flexibility, but it's harder to configure and manage. Its complexity and known headaches associated with its usage can drive some developers away.

We built Camera Manager to create custom camera views using the best qualities of these tools: better interaction with AVCaptureSession and the flexibility of AVFoundation while hiding all the nitty-gritty details from the developer.

With Camera Manager, the developer can create beautiful custom UIs and achieve awesome results with photos, without reinventing the wheel.

blue arrow to the left
Imaginary Cloud logo
blue arrow to the left
Imaginary Cloud logo

Camera Manager Interface

 

Camera Manager Interface

Camera Manager provides a simple custom iOS camera view to capture photos and record videos easily, with the following features:

  • front/rear camera selection;
  • tap to focus;
  • pinch to zoom;
  • exposure slider;
  • flash mode;
  • camera quality output;

  • focus mode;
  • exposure mode;
  • flip front camera image;
  • custom album names for image and video;


  • EXIF metadata;

  • save location to EXIF.

To provide all these capabilities, Camera Manager uses AVCaptureSession, which according to Apple is: "an object that manages capture activity and coordinates the flow of data from input devices to capture."

 

AV Capture Session Flow

Instead of manually creating a capture session, obtaining and configuring the necessary capture devices, creating inputs using the capture devices, and configuring a video/photo output object to process captured videos/images, the developer only needs to add the preview layer to the desired view.


All the changes to the AVCaptureDevice, such as setting the flash mode and switching between the front and back cameras, are safely done and configured by Camera Manager.

And then when capturing an image:


Also, to start and stop the recording of a video:


As demonstrated, Camera Manager provides the flexibility from AVCaptureSession while maintaining the simplicity from UIImagePickerViewController.

 

Camera Manager Test Photo

There are some alternatives available, but Camera Manager has a few strong points that make it an exceptional choice:

  • It is written in Swift: many of the most used alternatives are written in Objective-C. Given that almost every new app is written in Swift and Apple commits to the language, it makes sense to use Swift to ensure that the app will be way more future-proof.

  • It is highly configurable: Camera Manager gives the developer full control of the functionality needed to build great camera apps.

  • Focus on functionality, not UI: some libraries come bundled with their own UI. Camera Manager focuses on functionality and gives the developer full control to implement the UI as he pleases.
blue arrow to the left
Imaginary Cloud logo

Download Camera Manager

We encourage you to try it. Camera Manager has an example app that you can run on your device. You'll need a real device to run it, due to the use of AVFoundation camera API's which are unavailable on the iOS simulator.

Ready for a UX Audit? Book a free call

Found this article useful? You might like these ones too!

blue arrow to the left
Imaginary Cloud logo
blue arrow to the left
Imaginary Cloud logo
blue arrow to the left
Imaginary Cloud logo
blue arrow to the left
Imaginary Cloud logo
blue arrow to the left
Imaginary Cloud logo
blue arrow to the left
Imaginary Cloud logo
blue arrow to the left
Imaginary Cloud logo
Ricardo Torrão
Ricardo Torrão

Senior Developer at Imaginary Cloud, specialising in creating innovative software solutions, passionate about technology and coding excellence.

Read more posts by this author

People who read this post, also found these interesting:

arrow left
arrow to the right
Dropdown caret icon