This was a very nice tutorial, but with the latest stuff had to fix a couple of things.
Had to change
.compactMap { buffer in
return CGImage.create(from: buffer)
to
.compactMap { buffer in
return CGImage.create(from: buffer!)
This was bugging out do to empty buffer for a bit, so had to do something like this
if buffer != nil
{
return createCGImage(from: buffer!)
}
else
{
return drawMyImage()
}
Where drawMyImage is a simple CGImage Creator that is needed until things spin up.
Also what is missing I think is
enum CameraError
{
case deniedAuthorization
case restrictedAuthorization
case unknownAuthorization
case cameraUnavailable
case cannotAddInput
case cannotAddOutput
case createCaptureInput
}