Closed waelsaad closed 1 year ago
Hi @waelsaad,
was wondering if there's a more concise or elegant way to achieve the same result.
If you're not targeting watchOS, you can (probably) just use the default QR code generator instead of specifying the external generator.
let d = QRCode.Document(generator: QRCodeGenerator_External())
d.errorCorrection = .high
d.utf8String = "https://www.swift.org"
becomes
let d = QRCode.Document(utf8String: "https://www.swift.org", errorCorrection, .high)
also how to use circle center (QRCode.LogoTemplate.CircleCenter)
let document: QRCode.Document = {
let d = QRCode.Document(utf8String: "https://www.swift.org", errorCorrection, .high)
d.logoTemplate = QRCode.LogoTemplate.CircleCenter(image: myImage, inset: 3)
return d
}()
How can I change the tint color of the centered logo
Tinting images is not part of this library. I have another library called Bitmap which has the ability to tint an image
guard
let orig = CGImage.named("verified_user"),
let tintedImage = try? Bitmap(orig)
.tinting(with: CGColor(red: 0, green: 0, blue: 1, alpha: 1)
.cgImage
else {
// handle error
}
If you're not keen to add another library to your code, you can look through the Bitmap source code for tinting.
Hope this helps!
Hi @dagronf thank you so much for the response and correcting the code, its exactly what I was looking for and I'll be looking into the Bitmap. Kind Regards.
Brilliant mate. Glad I can help.
Hi there, I've been diving into QRCode generation, thank you for this project. I've come across the following code and was wondering if there's a more concise or elegant way to achieve the same result.
How can I change the tint color of the centered logo, also how to use circle center (QRCode.LogoTemplate.CircleCenter) perhaps there is a more direct way to center the logo as oppose to using path as below?