yeahdongcn / RSBarcodes_Swift

1D and 2D barcodes reader and generators for iOS 8 with delightful controls. Now Swift.
MIT License
709 stars 185 forks source link

Swift 4.0 migration #101

Closed VFUC closed 6 years ago

VFUC commented 7 years ago

Swift 4.0 migration, built successfully with the Xcode 9 GM, no merge conflicts

Thanks for this repo and the previous work! Cheers

frranck commented 7 years ago

This is weird, this datamatrix doesn't work for me after this PR.

Gerst20051 commented 7 years ago

Can you resolve merge conflicts? @VFUC

VFUC commented 7 years ago

I've resolved the conflicts, the (deprecated) @objc Inference is now removed. I think the CI fails because it uses Xcode 8 rather than 9. I have little experience with Travis, can anyone help out here?

VFUC commented 7 years ago

I've updated the sample project as well, it now builds successfully with Swift 4.

⚠️ I ran the sample App and had trouble scanning codes. I'm not sure if this was caused by the Swift 4 migration or if this happened before and should be handled separately.

zeusent commented 7 years ago

How is this coming along?

frranck commented 7 years ago

@VFUC this has changed: //open func metadataOutput(captureOutput: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection) { public func metadataOutput(_ output: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection) {

this is why it doesn't work

VFUC commented 7 years ago

Hey, sorry I took a bit to get back to this. Thanks for the hint, @frranck! You were absolutely right, I fixed the delegate method and the barcode scanning works again in the sample app. The datamatrix you mentioned works as well.

I've updated the travis file to use xcode9, hopefully the build will pass this time around. 🙂

VFUC commented 7 years ago

Missed the tests oops 😇

codecov-io commented 7 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@c562bfb). Click here to learn what that means. The diff coverage is 19.47%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #101   +/-   ##
=========================================
  Coverage          ?   49.56%           
=========================================
  Files             ?       23           
  Lines             ?     1390           
  Branches          ?        0           
=========================================
  Hits              ?      689           
  Misses            ?      701           
  Partials          ?        0
Impacted Files Coverage Δ
Source/RSFocusMarkLayer.swift 0% <ø> (ø)
Source/RSCodeLayer.swift 0% <ø> (ø)
...SBarcodesSample/BarcodeDisplayViewController.swift 0% <0%> (ø)
Source/RSCornersLayer.swift 0% <0%> (ø)
.../RSBarcodesSampleTests/RSBarcodesSampleTests.swift 100% <100%> (ø)
Source/RSCodeReaderViewController.swift 12.83% <12.83%> (ø)
...RSBarcodesSample/BarcodeReaderViewController.swift 45.45% <42.85%> (ø)
Source/UIColorExtension.swift 26.98% <42.85%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c562bfb...19ec931. Read the comment docs.

aleene commented 6 years ago

In UIColorExtension.swift is the line: let hexString: String = rgba.substring(from: rgba.index(rgba.startIndex, offsetBy: 1))

As substring is no longer supported in Swift 4, it should be replaced by: let index = rgba.index(rgba.startIndex, offsetBy: 1) let hexString = String(rgba[index...])

aleene commented 6 years ago

You can deprecate length() and replace it with count.

yeahdongcn commented 6 years ago

Thanks.

abdulowork commented 6 years ago

Any chance this pr is going to merged soon?

tomaskraina commented 6 years ago

would be awesome to get this merged soon! ✌️

neoneye commented 6 years ago

I just tried downloading this PR and compiling using Xcode9.2, but I'm seeing these warnings

screen shot 2018-02-02 at 11 04 40

My iPhone6S had no problems scanning the datamatrix mentioned earlier in this PR.

VFUC commented 6 years ago

Seems like the maintainer has no interest in this PR (which is fine of course, they seem to have looked at Swift 4 compatibility on their own anyways) - If that's not the case, just let me know and I'll have a look at the conflicts and warnings. 🙂