Using Swift and AVFoundation to create a custom camera view for an iOS app

Using Swift and AVFoundation to create a custom camera view for an iOS app

2

Capturing images in iOS When you want take a photo with your iOS device, there are two ways to go about it. The image picker controller is an out-of-the-box solution for capturing photos and videos. It is easy to set up, but does not provide a very flexible experience. The alternative is to create a custom capture user interface with the AVFoundation library. However, using the AVFoundation requires each component be configured and connected. This post explains how to use the AVFoundation components in a simple photo app. It should be enough to get you started if you want to use a custom camera in your app. Project Setup Create a single view application with Swift as the programming language and select iPhone for the device. In the project settings, in the Deployment Info section, find the Device Orientation subsection and make sure only “Portrait” is checked. That avoids the complications of the device rotating

Read more