Latest 1.1.0
License MIT
Platforms ios 10.0, requires ARC

A simple & easy-to-use iOS camera wrapper, written in Swift 3. Currently supports taking still photos.


There’s often a lot of boilerplate code required when building a custom camera in iOS. For example, dealing with orientation when taking photos using AVCaptureSession, AVCapturePhotoOutput and AVCaptureVideoPreviewLayer can be painful. This framework aims to do the work for you.

To help simplify the interface, this framework presumes the device has both a front and back camera.


First, import TWCameraView:

import TWCameraView

Next, initialise the view, set the delegate, and start the preview:

let cameraView = TWCameraView()
cameraView.delegate = self

cameraView.startPreview(requestPermissionIfNeeded: true)

Setting the requestPermissionIfNeeded flag automatically asks the user for camera permission, and starts the preview session if granded. If you pass false, and no permission has been granted, the preview will not start. Remember to set NSCameraUsageDescription in your Info.plist – this will be displayed in the permission alert.

To take a photo, just call capturePhoto():



cameraView.capturePhoto(imageStabilization: true, flashMode: .off)

The delegate callback function cameraViewDidCaptureImage(image: UIImage, cameraView: TWCameraView) will be called with the output UIImage.

Front or back camera?

TWCameraView supports either camera, but default to back. Just set the cameraType setting:

self.cameraView?.cameraType = .front


self.cameraView?.cameraType = .back


The MIT License (MIT)

Latest podspec

    "name": "TWCameraView",
    "version": "1.1.0",
    "summary": "Simple & easy-to-use Swift camera view for iOS.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Tom Weightman": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.1.0"
    "requires_arc": true,
    "platforms": {
        "ios": "10.0"
    "source_files": "TWCameraView/*.swift",
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "3.0"
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This