-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swift 4.0 #100
Comments
see #101 |
There seem to be some Swift 4 updates on the master branch already - has this been handled already? If so, I'll close my merge request. If not, I'll update it and resolve the conflicts. |
Have you tried using the master branch directly?
|
I've tried - it's crashing |
you can just change swift language version param from this pod build settings back to 3.2 and it will work just fine until the new release with swift 4 support is available |
Any news on this? I still see version 3.0.3 as being the latest. Can someone push a new |
Just wanted to let you know, that there are only several items that need to be corrected for Swift 4, not a big deal. I am just going to paste some of the items here: here the .rawValue needed to be added ( including a few other places ... ) open func generateCode(_ contents: String, inputCorrectionLevel: InputCorrectionLevel, machineReadableCodeObjectType: String) -> UIImage? {
var codeGenerator: RSCodeGenerator?
switch machineReadableCodeObjectType {
case AVMetadataObject.ObjectType.qr.rawValue, AVMetadataObject.ObjectType.pdf417.rawValue, AVMetadataObject.ObjectType.aztec.rawValue:
return RSAbstractCodeGenerator.generateCode(contents, inputCorrectionLevel: inputCorrectionLevel, filterName: RSAbstractCodeGenerator.filterName(machineReadableCodeObjectType))
case AVMetadataObject.ObjectType.code39.rawValue:
codeGenerator = RSCode39Generator()
case AVMetadataObject.ObjectType.code39Mod43.rawValue:
codeGenerator = RSCode39Mod43Generator()
case AVMetadataObject.ObjectType.ean8.rawValue:
codeGenerator = RSEAN8Generator()
case AVMetadataObject.ObjectType.ean13.rawValue:
codeGenerator = RSEAN13Generator()
case AVMetadataObject.ObjectType.interleaved2of5.rawValue:
codeGenerator = RSITFGenerator()
case AVMetadataObject.ObjectType.itf14.rawValue:
codeGenerator = RSITF14Generator()
case AVMetadataObject.ObjectType.upce.rawValue:
codeGenerator = RSUPCEGenerator()
case AVMetadataObject.ObjectType.code93.rawValue:
codeGenerator = RSCode93Generator()
// iOS 8 included, but my implementation's performance is better :)
case AVMetadataObject.ObjectType.code128.rawValue:
if self.isBuiltInCode128GeneratorSelected {
return RSAbstractCodeGenerator.generateCode(contents, inputCorrectionLevel: inputCorrectionLevel, filterName: RSAbstractCodeGenerator.filterName(machineReadableCodeObjectType))
} else {
codeGenerator = RSCode128Generator()
}
case AVMetadataObject.ObjectType.dataMatrix.rawValue:
codeGenerator = RSCodeDataMatrixGenerator()
case RSBarcodesTypeISBN13Code:
codeGenerator = RSISBN13Generator()
case RSBarcodesTypeISSN13Code:
codeGenerator = RSISSN13Generator()
case RSBarcodesTypeExtendedCode39Code:
codeGenerator = RSExtendedCode39Generator()
default:
print("No code generator selected.")
}
if codeGenerator != nil {
codeGenerator!.fillColor = self.fillColor
codeGenerator!.strokeColor = self.strokeColor
return codeGenerator!.generateCode(contents, inputCorrectionLevel: inputCorrectionLevel, machineReadableCodeObjectType: machineReadableCodeObjectType)
} else {
return nil
}
} The last row in the barHandler also: func barHandler() {
self.barcodesHandler = { barcodes in
for barcode in barcodes {
self.session.stopRunning()
print("Barcode found: type=" + barcode.type.rawValue + " value=" + barcode.stringValue!)
DispatchQueue.main.async(execute: { () -> Void in
// // MARK: NOTE: Perform UI related actions here.
if let barcode_discovered = barcode.stringValue {
discoveredBarcode = barcode_discovered
self.dismiss(animated: true, completion: nil)
}
})
}
}
let types = NSMutableArray(array: self.output.availableMetadataObjectTypes)
types.remove(AVMetadataObject.ObjectType.qr)
self.output.metadataObjectTypes = NSMutableArray(array: types) as? [AVMetadataObject.ObjectType]
} |
Is there a branch for Swift 4.0? Are there plans for such a branch soon?
The text was updated successfully, but these errors were encountered: