init(view:deviceTypes:changeHandler:)
Creates a coordinator that reports the direction cameras face in relation to the specified view.
Declaration
init(view: UIView, deviceTypes: [AVCaptureDevice.DeviceType], changeHandler: ((AVCaptureDeviceDirectionMap) -> Void)? = nil)Parameters
- view:
The view that camera directions are relative to.
- deviceTypes:
The device types the coordinator considers. It reports no other cameras.
- changeHandler:
A callback the coordinator invokes on the main actor soon after you create it, and again each time a camera changes direction. It receives an Avcapturedevicedirectionmap that groups the cameras by the direction they now face. Pass
nilto read Devicedirections yourself instead of receiving updates. A coordinator keeps the handler it’s created with, so create a new coordinator to change it.