aschuch / qrcode Goto Github PK
View Code? Open in Web Editor NEWA QRCode generator written in Swift.
License: MIT License
A QRCode generator written in Swift.
License: MIT License
swift package init
Please add Package.swift
branch: Swift 2.2
xcode 7.3.x
Steps to repro:
actual:
Github/QRCode/QRCode/CIImageExtension.swift:21:15: Initializer for conditional binding must have Optional type, not 'CGImage'
/Github/QRCode/QRCode/QRCode.swift:63:41: Cannot use optional chaining on non-optional value of type 'String'
Is there a specific reason why the initialisers for string and NSURL both encode the input as latin1 instead of UTF-8?
public init?(_ string: String) {
if let data = string.dataUsingEncoding(NSISOLatin1StringEncoding) {
self.data = data
} else {
return nil
}
}
public init?(_ url: NSURL) {
if let data = url.absoluteString.dataUsingEncoding(NSISOLatin1StringEncoding) {
self.data = data
} else {
return nil
}
}
Hello,
This a very nice work, but I have one question, it is possible to put a logo in the middle of the QR Code ?
Thank's in advance.
Can you update the pod on CocoaPods to 1.0 please? :)
Is it possible to add extension for apple watch ?
Hi,
What is the maximum capacity that can be encoded for an ASCII encoded string?
Thanks,
:panos
it would be great to leverage this in tvOS
Crash when using CIContext(options:)
in CIImageExtensions.swift line 21. Seems to be an issue of Xcode 8 which is having issues translating the Swift 3 options:
notation into contextWithOptions:
(instead of initWithOptions
). Writing a second helper extension in Obj-C would be a workaround.
I received this error when i try to install this library with cathage.
In cartfile:
github "aschuch/QRCode"
Error:
*** Building scheme "QRCode" in Example.xcodeproj
** BUILD FAILED **
The following build commands failed:
CompileSwift normal x86_64 /project-path/Carthage/Checkouts/QRCode/QRCode/CIColorExtension.swift
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)
Can you push latest Pod to CocoaPods registry
Hi,
What is the error correction level used for the generated qr codes?
Is there a way to specify it?
Thanks,
:panos
UIImage(data: QRCode("WILLLiiii")!.data)
ios9
The created image gets streched even when using UIViewContentModeScaleAspectFit on a UIImageView.
Fixed it by adding another conversion step (CIImage -> CGImage -> UIImage).
Querschlag@f603d59
Update: This also fixes image preview in the debugger.
To build for Swift 3.0
for the time being you need to add this to your Podfile
`pod 'QRCode', :git => "[email protected]:aschuch/QRCode.git", :branch => "swift3.0"`
The latest version available on cocoapods is 0.5. Maybe you forgot to update the new version on cocoapods ?
i think using extension to invoke have a better experience. like:
stringA.QRImage()
this method could have some default parameters,like size or something else.
if you agree with this , I can spend some time work on it,create a pull request
Hey Guys,
Trying to convert image to nsdata, but receive nil. Tried both PNG and JPEG.
let qrc = QRCode("sample")
let img = UIImagePNGRepresentation(qrc.image!) // img is nil
Please advice
Dear Alexander, how are you?
On swift 4 build IOS 11 I'm facing a warning that is relatively easy to solve:
Class: CIColorExtension.swift
Line 32:
if scanner.scanHexInt64(&hexValue) {
let length = rgba.characters.count
Warning Message: 'characters' is deprecated: Please use String or Substring directly
Thanks
I placed the high error correction in and the code still appears blurry.
var qrImage = UIImageView(frame: CGRectMake((lpScroll.frame.size.width - qrWidth) / 2, ish, qrWidth, qrWidth))
let url = NSURL(string: url4Sharing)
var qrCode = QRCode(url!)
qrCode?.errorCorrection = QRCode.ErrorCorrection.High
qrCode?.color = CIColor(color: UIColor.cloudsColor())
qrCode?.backgroundColor = CIColor(color: darkColor)
qrCode?.size = CGSize(width: qrWidth * 2, height: qrWidth * 2)
qrImage.image = qrCode?.image
lpScroll.addSubview(qrImage)
i guess you need to app a key to info.plist for Privacy - Media Library Usage Description
app Binary was invalid till i add to my info.plist the Error was missing this Key "NSPhotoLibraryUsageDescription"
please put a hint in readme file as it required from iOS 10
any plan to update to swift 4?
Hi,
Below code will be crashed on Xcode8
guard let cgImage = CIContext(options: nil).createCGImage(self, fromRect: self.extent) else { return nil }
'NSInvalidArgumentException', reason: '-[CIContext initWithOptions:]: unrecognized selector
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.