Initializes an input to use a specified device.


init(device: AVCaptureDevice) throws



The device from which to capture input.


If an error occurs during initialization, upon return contains an NSError object describing the problem.

Return Value

An input initialized to use device.


In Swift, this API is imported as an initializer and is marked with the throws keyword to indicate that it throws an error in cases of failure.

You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in The Swift Programming Language (Swift 4.1) and About Imported Cocoa Error Parameters.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software