STCaptureSessionPreset type declaration missing


#1

Trying to incorporate Sample Scanner capabilities into custom Swift app. After including all Objective-C files from the SDK and creating the proper bridging header, I have a number of errors at any reference to the STCaptureSessionPreset type in the source code.

I checked in the Scanner project in Xcode itself and noticed the same errors, as if this type is never initialized or declared. Is this a common issue?

08%20PM


#2

STCaptureSessionPreset is just an enumerated type, and Swift will change the name to this:

STCaptureSessionPreset.default
STCaptureSessionPreset.bodyScanning
STCaptureSessionPreset.outdoor
STCaptureSessionPreset.roomScanning
STCaptureSessionPreset.closeRange

If comparing to another Int type, use the rawValue of the enum type:
STCaptureSessionPreset.default.rawValue
STCaptureSessionPreset.bodyScanning.rawValue
STCaptureSessionPreset.outdoor.rawValue
STCaptureSessionPreset.roomScanning.rawValue
STCaptureSessionPreset.closeRange.rawValue

You also use the rawValue if converting to an NSNumber:
NSNumber(value: STCaptureSessionPreset.default.rawValue)
NSNumber(value: STCaptureSessionPreset.bodyScanning.rawValue)
NSNumber(value: STCaptureSessionPreset.outdoor.rawValue)
NSNumber(value: STCaptureSessionPreset.roomScanning.rawValue)
NSNumber(value: STCaptureSessionPreset.closeRange.rawValue)