CameraViewController

@available(iOS 9.0, *)
@objcMembers
@objc(PESDKCameraViewController)
open class CameraViewController : UIViewController

The CameraViewController class provides a dialog to perform serveral tasks regarding the camera. These include taking photos, switching on the flash, and such.

  • Creates a camera view controller using the given parameters.

    Note

    If you use the standard init() method or init?(coder:) to initialize a CameraViewController object, a camera view controller with all supported recording modes and the default configuration is created.

    Declaration

    Swift

    public init(configuration: Configuration = Configuration())

    Parameters

    configuration

    A Configuration object.

  • Generate a photo edit model from the current camera settings. This model can be passed to a PhotoEditViewController in order to have the edited image look like the preview image in the camera’s viewfinder.

    Declaration

    Swift

    open var photoEditModel: PhotoEditModel { get }
  • The view that contains the background views.

    Declaration

    Swift

    open private(set) lazy var backgroundContainerView: UIView { get set }
  • The view that contains all view positioned at the top of the screen.

    Declaration

    Swift

    open private(set) lazy var topControlsView: UIView { get set }
  • The view that serves as container for the actual preview.

    Declaration

    Swift

    open private(set) lazy var cameraPreviewContainer: UIView { get set }
  • The view that contains all view positioned at the bottom of the screen.

    Declaration

    Swift

    open private(set) lazy var bottomControlsView: UIView { get set }
  • The view that spans from the bottom of the screen to the bottom of the safeAreaLayoutGuide. This is only visible on an iPhone X.

    Declaration

    Swift

    open private(set) lazy var bottomSafeAreaHidingView: UIView { get set }
  • The cancel button.

    Declaration

    Swift

    open private(set) lazy var cancelButton: Button { get set }
  • The flash button.

    Declaration

    Swift

    open private(set) lazy var flashButton: Button { get set }
  • The camera switch button.

    Declaration

    Swift

    open private(set) lazy var switchCameraButton: Button { get set }
  • The camera roll button

    Declaration

    Swift

    open private(set) lazy var cameraRollButton: Button { get set }
  • The view that contains actions button that is used to initiate the photo capturing process.

    Declaration

    Swift

    open private(set) lazy var actionButtonContainer: UIView { get set }
  • The label that is used to display the current recording time.

    Declaration

    Swift

    open private(set) lazy var recordingTimeLabel: UILabel { get set }
  • The button that is used to initiate the photo capturing process.

    Declaration

    Swift

    open private(set) var actionButton: UIControl?
  • The view that is used to select the current filter that is applied to the preview.

    Declaration

    Swift

    open private(set) lazy var filterSelectionButton: Button { get set }
  • The slider that is used to control the inensity of the previewed filter.

    Declaration

    Swift

    open private(set) lazy var filterIntensitySlider: Slider { get set }
  • The recognizer that detects a swipe gesture to the right.

    Declaration

    Swift

    open private(set) lazy var swipeRightGestureRecognizer: UISwipeGestureRecognizer { get set }
  • The recognizer that detects a swipe gesture to the left.

    Declaration

    Swift

    open private(set) lazy var swipeLeftGestureRecognizer: UISwipeGestureRecognizer { get set }
  • The recognizer that detects a pinch gesture.

    Declaration

    Swift

    open private(set) lazy var pinchGestureRecognizer: UIPinchGestureRecognizer { get set }
  • The instance of a FilterSelectionController that is used to select the current preview filter.

    Declaration

    Swift

    public let filterSelectionController: FilterSelectionController
  • The camera controller that is used by the controller.

    Declaration

    Swift

    open private(set) var cameraController: CameraController?
  • The block that is called when the user taps the cancel button. See CameraViewControllerOptions.showCancelButton.

    Declaration

    Swift

    open var cancelBlock: (() -> Void)?
  • The block that is called once the capture process has finished.

    Declaration

    Swift

    open var completionBlock: ((UIImage?, URL?) -> Void)?
  • When this closure is called, the SDK has determined that location access has not been granted to the host app yet. Within this closure you should then request appropriate permissions from the passed in CLLocationManager object. Location access is used to tag photos with the location where they are taken.

    Attention

    Starting Spring 2019, all apps submitted to the App Store that access user data are required to include a purpose string as soon as location permissions requests appear somewhere in the binary. Since we do not want to force developers integrating the SDK into their app to include a purpose string even with location tagging disabled, this closure was introduced, so that developers can decide for themselves if it is appropriate to request location access. Simply set this property like this: cameraViewController.locationAccessRequestClosure = { locationManager in locationManager.requestWhenInUseAuthorization() }

    Declaration

    Swift

    open var locationAccessRequestClosure: ((CLLocationManager) -> Void)?
  • The block that is called once a photo has been taken. It is passed a Data instance, containing a JPEG image with metadata. The UIImage passed to completionBlock does not contain any metadata. If this is set, then completionBlock is only called when images are loaded from the camera roll.

    Declaration

    Swift

    open var dataCompletionBlock: ((Data?) -> Void)?
  • This function gets the most recent image form the camera roll, and sets it as preview image for the according button.

    Declaration

    Swift

    open func setLastImageFromRollAsPreview()
  • Takes a photo.

    Declaration

    Swift

    open func takePhoto(_ sender: Button?)

    Parameters

    sender

    The object that initiated the request.

  • Toggles video recording.

    Declaration

    Swift

    open func recordVideo(_ sender: VideoRecordButton?)

    Parameters

    sender

    Sender of the event.

  • Generate a photo edit model from the current camera settings. This model can be passed to a PhotoEditViewController in order to have the edited image look like the preview image in the camera’s viewfinder.

    Declaration

    Swift

    @objc(photoEditModel)
    open var _objCPhotoEditModel: _ObjCPhotoEditModel { get }