AVCamManual/AVCamManualPreviewView.m

/*
    Copyright (C) 2016 Apple Inc. All Rights Reserved.
    See LICENSE.txt for this sample’s licensing information
    
    Abstract:
    Camera preview.
*/
 
@import AVFoundation;
 
#import "AVCamManualPreviewView.h"
 
@implementation AVCamManualPreviewView
 
+ (Class)layerClass
{
    return [AVCaptureVideoPreviewLayer class];
}
 
- (AVCaptureSession *)session
{
    AVCaptureVideoPreviewLayer *previewLayer = (AVCaptureVideoPreviewLayer *)self.layer;
    return previewLayer.session;
}
 
- (void)setSession:(AVCaptureSession *)session
{
    AVCaptureVideoPreviewLayer *previewLayer = (AVCaptureVideoPreviewLayer *)self.layer;
    previewLayer.session = session;
}
 
@end