Giter VIP home page Giter VIP logo

rsbarcodes_swift's People

Contributors

akuehlewind avatar alphatroya avatar bstrull avatar daande avatar dbmrq avatar getaaron avatar gkchristopher avatar gps avatar guykogus avatar jakemarsh avatar jarvie8176 avatar jcarroll-mediafly avatar kseniya-hydric avatar matthewellis avatar mfks17 avatar mitsuse avatar mjrehder avatar neoneye avatar nosovpavel avatar pvieito avatar satoru-prichan avatar tomaskraina avatar vfuc avatar winzig avatar yanmeow avatar yeahdongcn avatar zeusent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rsbarcodes_swift's Issues

conflict with main window background color

It appears that setting

self.window?.backgroundColor = UIColor.greenColor()

in didFinishLaunchingWithOptions conflicts with the RSCodeReaderViewController camera view. The camera view doesn't use the camera; rather, it is simply a UIViewController with the same background color as declared above

I successfully reproduced this bug on a dummy project, and it does demonstrate this behavior for regular UIImagePickerController

Any ideas/ suggestions?

Orientation change not working

Hi,

I've created a view controller that is working in general.
The problem however is that if I start the app in portrait mode everything is working.
If I turn the app to landscape, all UI elements are changing but the camera is still showing the portrait view.

Does anyone know this problem?

Thanks
David

Active Scanning Area

I can't seem to figure out why the barcodes are only scanned when it's in the top half of the camera feed. This is true in portrait and landscape orientation. Is this expected behavior?

Not handling rotation

The scanner view (actually the AVCaptureVideoPreviewLayer) does not handle rotation properly.
I could make it better by adding this in RSCodeReaderViewController.swift - however the orientation is still wrong when the initial device orientation is not portrait (such as with an iPad).

override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
    let previousTransform = layer!.affineTransform()
    let rotation = coordinator.targetTransform()
    let newTransform = CGAffineTransformConcat(previousTransform, CGAffineTransformInvert(rotation))
    layer!.setAffineTransform(newTransform)
    layer!.frame.origin = CGPointZero
}

P.S: Thanks for this great library!

Xcode does not recognize the class when creating a new file

Hi

Installed using Cocoapods, went through the reader process and when I get to the point where I need to choose a subclass for ScanViewController, RSCodeReaderViewController isn't there.

However, if I hard code RSCodeReaderViewController as a subclass, and cmd+click on RSCodeReaderViewController in the file, I successfully get directed to its implementation.

Nonetheless the ScanViewController file throws multiple errors, the first one indicating "Use of undeclared type 'RSCodeReaderViewController'".

Any ideas?

QRCode appears small

the QRCode appears very small...

let image: UIImage? = gen.generateCode(contents, machineReadableCodeObjectType: AVMetadataObjectTypeQRCode)
if let image = image {
self.barcodeView.image = RSAbstractCodeGenerator.resizeImage(image, scale: 1.0)
}

App crashing when resizeImage is called

We're getting some crashes in our live app.

RSCodeGenerator.swift line 210
static RSAbstractCodeGenerator.resizeImage(UIImage, scale : CGFloat) -> UIImage

Crashed: com.apple.main-thread
EXC_BREAKPOINT 0x00000001010f1d14

    public class func resizeImage(source:UIImage, scale:CGFloat) -> UIImage {
        let width = source.size.width * scale
        let height = source.size.height * scale

        UIGraphicsBeginImageContext(CGSizeMake(width, height))
        let context = UIGraphicsGetCurrentContext()
        CGContextSetInterpolationQuality(context, CGInterpolationQuality.None)
        source.drawInRect(CGRectMake(0, 0, width, height))
        let target = UIGraphicsGetImageFromCurrentImageContext()
        UIGraphicsEndImageContext()
        return target
    }

Switch Cameras

Is there a way I can switch the default camera to the front one?

Generators for the EAN family can not be instantiated

The specialized classes are all declared internal, so they can't be used outside the RSBarcodes_Swift module.

class RSEAN8Generator: RSEANGenerator {
...
}

class RSEAN13Generator: RSEANGenerator {
...
}

class RSISBN13Generator: RSEAN13Generator {
...
}

class RSISSN13Generator: RSEAN13Generator {
...
}

Unknown class

2014-11-29 02:48:10.998 *[1259:60b] Unknown class _TtC10RSBarcodes26RSCodeReaderViewController in Interface Builder file.

Rotation of cornerLayer and focusMarkLayer

I notice that certain layers were not resizing on rotation. Here is a proposed fix in RSCodeReaderViewController.swift

    override public func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
        super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)

        if videoPreviewLayer != nil {
            videoPreviewLayer!.frame = CGRectMake(0, 0, size.width, size.height)
            focusMarkLayer!.frame = CGRectMake(0, 0, size.width, size.height)
            cornersLayer!.frame = CGRectMake(0, 0, size.width, size.height)
        }
    }

I am not certain this is the best way, please advise.

Swift-2.0 branch podspec?

I would like to use Swift-2.0 branch but it seems the 2.0 podspec is the same as master so these is no way to use the 2.0 code via cocopods. Is this correct or am I missing something?

I'd like to do something like:

pod 'RSBarcodes_Swift', :git => 'https://github.com/yeahdongcn/RSBarcodes_Swift.git', :branch => 'Swift-2.0'```

[Update] Seems as though entering the above actually did work for my Swift 2.0 project. Not quite sure why it didn't use the latest tag from master. 

Not handling initial orientation when not portrait

You are now using onApplicationDidChangeStatusBarOrientation to handle orientation changes.
This works fine when the device is initially in portrait but not if it is for example an iPad starting the app in landscape.
Using viewDidLayoutSubviews instead with the exact same code works fine:

override func viewDidLayoutSubviews() {
    if videoPreviewLayer != nil
        && videoPreviewLayer!.connection.supportsVideoOrientation {
            videoPreviewLayer!.connection.videoOrientation = RSCodeReaderViewController.InterfaceOrientationToVideoOrientation(UIApplication.sharedApplication().statusBarOrientation)
    }
}

Barcode handler not displaying barcodes when placed in Container View

I created a container view that was placed in the main view. Main view does not use RSCodeReaderViewController, but the view inside container view does. When I get to run the app, it displays the preview layer and I can alternate stroke colors, self.focusMarkLayer.strokeColor = UIColor.redColor().CGColor. However, when I point to the barcode, nothing gets displayed. What am I doing wrong?

beta 7 and swift 2.0

Is there any plans to update this for swift 2.0.

Should be a matter of converting and a bit of clean up. I'm not familiar enough with this library and swift to help myself otherwise I would.

cornerLayer stroke color is fixed

It would be nice to be able to chose the color for the RSCornersLayer.
I managed to allow this with these changes - there might be a better way :-)

In class RSCodeReaderViewController I added:

var cornerLayerColor = UIColor.greenColor()

override func viewWillLayoutSubviews() {
    cornersLayer.strokeColor = cornerLayerColor.CGColor
}

and in my custom subclass of RSCodeReaderViewController:

override func viewWillLayoutSubviews() {
    self.cornerLayerColor = UIColor(red: 255.0/255.0, green: 44.0/255.0, blue: 85.0/255.0, alpha: 1.0)
    super.viewWillLayoutSubviews()
}

Not showing anything

I have set up a ViewController as described, it worked a few times and I was able to scan codes, however now it just shows a black screen. I've given it access to my camera so I am not sure how to fix this issue. Any ideas?

self.barcodesHandler = {}执行了N次

我发现self.barcodesHandler = {barcodes in } 会执行N次,扫的码有多长就执行多少次,每次barcodes除了坐标不一样,条码的值都一样。

我想当扫码成功后,立即返回一个结果,也就是上述代码只执行一次最好,求指点该如何弄?

Ability to set view for scanning

Not sure if I'm using the correct xcode terms but here it goes..

Instead of initlizing the barcode scanner to take up the whole view controller, I want it to only display the preview window in a smaller UIView that is inside of the viewcontroller.. I haven't been able to figure out if this is possible with your existing code or not.

Find Type

I would like to create an application which receives various types of bar codes. How can I detect the type of code you are reading?

Thanks for the help

EXC_BAD_ACCESS in RSCornersLayer.swift

I'm seeing a EXC_BAD_ACCESS in Crashlytics in RSCornersLayer.swift. Unfortunately, Crashlytics is reporting this on line 0, which isn't all that helpful. Here's what it says:

RSBarcodes_Swift    
RSCornersLayer.swift line 0
function signature specialization <Arg[0] = Owned To Guaranteed, Arg[1] = Owned To Guaranteed> of RSBarcodes_Swift.RSCornersLayer.drawInContext (RSBarcodes_Swift.RSCornersLayer)(ObjectiveC.CGContext!) -> ()

RSBarcodes_Swift    
RSCornersLayer.swift line 0
@objc RSBarcodes_Swift.RSCornersLayer.drawInContext (RSBarcodes_Swift.RSCornersLayer)(ObjectiveC.CGContext!) -> ()

Did I do something wrong, or is there an issue here in RSBarcodes?

Cocoapods and/or Carthage?

Hi. It seems that neither Cocoapods nor Carthage are working right now. Are you planing to include this?

Build error

I'm getting a build error with the swift2 branch when installing using carthage:

.../RSBarcodes_Swift/Source/RSCodeGenerator.swift:159:76: error: value of optional type 'CIImage?' not unwrapped; did you mean to use '!' or '?'?
.../RSBarcodes_Swift/Source/RSCodeGenerator.swift:159:53: error: value of optional type 'CIImage?' not unwrapped; did you mean to use '!' or '?'?

Downcast issue

hi, i'm getting this Downcasting error for the Swift 3.0 branch
screen shot 2016-08-29 at 12 40 24 pm
screen shot 2016-08-29 at 12 40 49 pm

Beta 6

There is a couple of compiling issues since the beta 6 update.

update in wiki

need to import RSBarcodes_Swift manually in the ViewController file after creating the file using wizard.

Besides the sample controller file uses import RSBarcodes which should also be updated.

Swift 2.0 Branch - Build Fails on new branch.

screen shot 2015-07-16 at 11 42 11 am

Steps to reproduce: 1. Clone repo to local `git clone [email protected]:yeahdongcn/RSBarcodes_Swift.git` 2. Checkout Swift-2.0 branch. `git checkout origin/Swift-2.0` 2. Open RSBarcodes_Swift project in xcode beta 7 3. Set deployment target to iOS 8.0 or 9.0, happens for both. 4. Attempt to build library

As seen below, there are a few more errors as well when trying to build this new branch.
screen shot 2015-07-16 at 11 44 01 am

"Cannot Record" on AVCaptureDeviceInput

Have been using RSBarcodes for some time now, but somewhere between the latest IOS updates (9+), it began not working.

I now receive:
Error Domain=AVFoundationErrorDomain Code=-11814 "Cannot Read" UserInfo={NSLocalizedDescription=Cannot Record, NSLocalizedRecoverySuggestion=Try recording again.}

This occurs within "viewDidLoad()" in RSCodeReaderViewController on
"input = try AVCaptureDeviceInput(device: self.device)"

Any ideas?
Thanks, Ryan

Code39Generator Uppercase Limitation

The following block in RSCode39Generator.swift checks the contents against the .uppercaseString:

override public func isValid(contents: String) -> Bool {
        let length = contents.length()
        if length > 0 && contents == contents.uppercaseString {
            for character in contents.characters {
                let location = CODE39_ALPHABET_STRING.location(String(character))
                if location == NSNotFound {
                    return false
                }
            }
            return true
        }
        return false
    }

Other libraries (like zxing and barcodelib) will simply uppercase the contents and check to make sure afterwards.

Should we do this within RSBarcodes as well?

What is 'crazy mode'?

Re: 37f3de0

I saw your recent commit for "crazy mode," but was wondering if you could explain what this mode does? I looked around to see if I could find a mention here of Klenov Dmitry to see if there was already a discussion about it, but did not see any.

Performing Action When a Barcode Is Scanned

I am building an app that utilizes QR code scanning. What I am trying to do in my ScanViewController is to scan a QR code, validate what was scanned, and then segue with the scanned data. Currently, when a QR code is detected, my UI freezes, and shortly after I get an error and memory dump:

'NSInternalInconsistencyException', reason: 'Only run on the main thread!'.

Maybe, this isn't the right place to validate the QR code or isn't the right place to segue, but if not, I'm wondering where the validation and segue should take place. My only other requirement is that the validation only occurs when a QR code is detected, which I believe to happen when captureOutput() is called in RSCodeReaderViewController.

class ScanViewController: RSCodeReaderViewController{
    // Class Variables
    var finalObject: IBuiltCode?
    let ObjectHelper = ObjectBuilder() // Service to validate and build valid scanned objects

    override func viewDidLoad() {
        super.viewDidLoad()

        self.focusMarkLayer.strokeColor = UIColor.redColor().CGColor
        self.cornersLayer.strokeColor = UIColor.yellowColor().CGColor

        self.tapHandler = { point in
            println(point)
        }

        self.barcodesHandler = { barcodes in
            for barcode in barcodes {
                println("Barcode found: type=" + barcode.type + " value=" + barcode.stringValue)
                // returns nil if invalid (can provide validateAndBuild func code if necessary)
                var builtObject = self.ObjectHelper.validateAndBuild(barcode,
                      scannedData: barcode.stringValue)
                if builtObject != nil{
                    println("Good object.")
                    self.performQR()
                }
            }
        }
    }

    func performQR(){
        performSegueWithIdentifier("toQR", sender: self)
    }
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        if (segue.identifier == "toQR"){
            let QRVC: QRViewController = segue.destinationViewController as! QRViewController
            QRVC.receivedObject = finalObject as? QRObject
        }
    }
}

Where are the "delightful controls?"

The title of your project mentions "delightful controls," yet they apparently are nowhere to be found and undocumented. Are there any controls for a RSCodeReaderViewController, and if so how do they work?

Thank you!

RSEANGenerator cannot be initialised

The isValid function is not accessible because the class cannot be initialised.
Is there any reason why the init method is not public?

Thanks
Chetan

Barcode Reader comes up Blank when using storyboard

I created a view controller in storyboard and set it's subclass to an RSCodeReaderViewController type class, but when the app runs this view controller seems to come up blank.

When I create a view controller programmatically and present it as a modal, it works fine.

libsystem_kernel.dylib`__abort_with_payload:

It seems after iOS 10.0.1 update, I'm getting a crash on ViewDidLoad

Here is my code:

https://github.com/Treverr/inSparkle/blob/master/inSparkle/QRCodeScanner.swift

It just jumps right to crashing with very little to no information

libsystem_kernel.dylib`__abort_with_payload:
0x1877c4d6c <+0>: movz x16, #0x209
0x1877c4d70 <+4>: svc #0x80
-> 0x1877c4d74 <+8>: b.lo 0x1877c4d8c ; <+32>
0x1877c4d78 <+12>: stp x29, x30, [sp, #-16]!
0x1877c4d7c <+16>: mov x29, sp
0x1877c4d80 <+20>: bl 0x1877a97b4 ; cerror_nocancel
0x1877c4d84 <+24>: mov sp, x29
0x1877c4d88 <+28>: ldp x29, x30, [sp], #16
0x1877c4d8c <+32>: ret

Any ideas?

InputCorrectionLevel is incorrect

I hope only the comments are wrong!

public enum InputCorrectionLevel: String {
    case Medium = "M"   // 7%
    case Low = "L"      // 15% default
    case Quarter = "Q"  // 25%
    case High = "H"     // 30%
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.