From 1743fbe5934bf5eedf6ec16b51f8d5fd360f3770 Mon Sep 17 00:00:00 2001 From: Dave Poirier Date: Sat, 17 Jun 2017 17:00:41 -0400 Subject: [PATCH 1/9] Added missing import declarations Signed-off-by: Dave Poirier --- QRCode/CIImageExtension.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/QRCode/CIImageExtension.swift b/QRCode/CIImageExtension.swift index f096069..4e42e47 100644 --- a/QRCode/CIImageExtension.swift +++ b/QRCode/CIImageExtension.swift @@ -7,6 +7,8 @@ // import Foundation +import UIKit +import CoreImage internal typealias Scale = (dx: CGFloat, dy: CGFloat) From 9abd4f8a3e9f7b4f7b44395c81fb15c95d9c4953 Mon Sep 17 00:00:00 2001 From: "Eric A. Soto" Date: Mon, 20 Mar 2017 19:15:09 -0400 Subject: [PATCH 2/9] Added a section to the readme.md about error correction, which is already implemented in the code, but was not otherwise mentioned in the docs. --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index 2bb0285..df70343 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,33 @@ qrCode.image // UIImage (green QRCode color and black background) > **Note**: The above examples make use of the `CIColor` extension that ships with this project to create colors based on HEX strings. +**Error Correction** + +QR codes support a configurable error correction setting. This controls how much of the generated image can be damaged or occluded, while still allowing for the code to be recognized correctly. + +To set error correction: + +```swift +qrCode.errorCorrection = .High +``` + +If you do not declare this property, the default will be `.Low`. + +Valid values and the corresponding error correction ability are: + +| Parameter Val | Correction Ability | +| ------------- | ------------------ | +| Low | Approx 7% | +| Medium | Approx 15% | +| Quartile | Approx 25% | +| High | Approx 30% | + +> For more information on Error Correction, see [QRcode.com](http://www.qrcode.com/en/about/error_correction.html). + +*Why would you want higher error correction?* + +Setting error correction above the default of Low allows you to create a QR code that can be damaged or covered but still scanned correctly. This allows for wear (if on a printed code) but also allows the use of graphics on top of the code. Therefore, QR codes can include a logo or other branding right over the qr code image (covering a part of it) and still will work. Note, however, that a higher amount of error correction also means that the QR code will be more "dense" (and therefore limits how small it might be printed/displayed.) + ### UIImageView extension For convenience, a `UIImageView` extension is provided to directly initialize an image view with an instance of `QRCode`. From 529ab49d01966c4cb8e373d174d1e32fea9dfcf6 Mon Sep 17 00:00:00 2001 From: 7owen Date: Tue, 19 Sep 2017 11:21:07 +0800 Subject: [PATCH 3/9] Run in xCode9 GM seed and ios8, it will be crash. --- QRCode/CIImageExtension.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QRCode/CIImageExtension.swift b/QRCode/CIImageExtension.swift index f096069..c083a00 100644 --- a/QRCode/CIImageExtension.swift +++ b/QRCode/CIImageExtension.swift @@ -18,7 +18,7 @@ internal extension CIImage { /// /// - returns: an non-interpolated UIImage internal func nonInterpolatedImage(withScale scale: Scale = Scale(dx: 1, dy: 1)) -> UIImage? { - guard let cgImage = CIContext(options: nil).createCGImage(self, from: self.extent) else { return nil } + guard let cgImage = CIContext().createCGImage(self, from: self.extent) else { return nil } let size = CGSize(width: self.extent.size.width * scale.dx, height: self.extent.size.height * scale.dy) UIGraphicsBeginImageContextWithOptions(size, true, 0) From 981891014cc0e30f31b5acfb4ba654e8ef167c52 Mon Sep 17 00:00:00 2001 From: 7owen Date: Tue, 19 Sep 2017 11:26:49 +0800 Subject: [PATCH 4/9] update podspec for 2.0.1 --- QRCode.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/QRCode.podspec b/QRCode.podspec index 0080c9f..9dccb27 100644 --- a/QRCode.podspec +++ b/QRCode.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "QRCode" - s.version = "2.0" + s.version = "2.0.1" s.summary = "A QRCode generator written in Swift." s.description = "Generate QRCodes and customize their appearance." s.homepage = "https://github.com/aschuch/QRCode" @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.author = { "Alexander Schuch" => "alexander@schuch.me" } s.social_media_url = "http://twitter.com/schuchalexander" s.platform = :ios, "8.0" - s.source = { :git => "https://github.com/aschuch/QRCode.git", :tag => s.version } + s.source = { :git => "https://github.com/lgw51/QRCode.git", :tag => s.version } s.requires_arc = true s.source_files = "QRCode/QRCode.swift", "QRCode/UIImageViewExtension.swift", "QRCode/CIColorExtension.swift", "QRCode/CIImageExtension.swift" end From 593fc3dc5ab4fb4da40fd0fd98b5f375c5420b7b Mon Sep 17 00:00:00 2001 From: Dave Poirier Date: Thu, 28 Jun 2018 07:49:40 -0400 Subject: [PATCH 5/9] Updated Travis-CI to Xcode 9.4 Signed-off-by: Dave Poirier --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 99858c0..f978f5c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode8.1 +osx_image: xcode9.4 env: global: - LC_CTYPE=en_US.UTF-8 @@ -10,7 +10,7 @@ env: #- WATCHOS_FRAMEWORK_SCHEME="QRCode-watchOS" matrix: #- DESTINATION="OS=9.3,name=iPhone 6S" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="iphonesimulator9.3" - - DESTINATION="OS=10.1,name=iPhone 6S" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="iphonesimulator10.1" + - DESTINATION="OS=11.4,name=iPhone 8" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="iphonesimulator11.4" #- DESTINATION="OS=9.2,name=Apple TV 1080p" SCHEME="$TVOS_FRAMEWORK_SCHEME" SDK="appletvsimulator9.2" #- DESTINATION="OS=2.2,name=Apple Watch - 42mm" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" SDK="watchsimulator2.2" #- DESTINATION="OS=10.0,name=Apple TV 1080p" SCHEME="$TVOS_FRAMEWORK_SCHEME" SDK="appletvsimulator10.0" From 2ef8fea0bdd494b01fc7d9ab3cbda550f4ef011a Mon Sep 17 00:00:00 2001 From: Dave Poirier Date: Thu, 28 Jun 2018 07:59:32 -0400 Subject: [PATCH 6/9] Swift 4.0 String .count Signed-off-by: Dave Poirier --- QRCode/CIColorExtension.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QRCode/CIColorExtension.swift b/QRCode/CIColorExtension.swift index 40b4435..44dd23b 100644 --- a/QRCode/CIColorExtension.swift +++ b/QRCode/CIColorExtension.swift @@ -29,7 +29,7 @@ public extension CIColor { var hexValue: CUnsignedLongLong = 0 if scanner.scanHexInt64(&hexValue) { - let length = rgba.characters.count + let length = rgba.count switch (length) { case 3: From 57217e33b2665133f91de2153f95a8167ac32cfd Mon Sep 17 00:00:00 2001 From: Dave Poirier Date: Thu, 28 Jun 2018 08:00:09 -0400 Subject: [PATCH 7/9] Updated project build numbers Signed-off-by: Dave Poirier --- Example/Info.plist | 2 +- QRCode/Info.plist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Example/Info.plist b/Example/Info.plist index 6905cc6..6c41484 100644 --- a/Example/Info.plist +++ b/Example/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0 + 2.0.1 CFBundleSignature ???? CFBundleVersion diff --git a/QRCode/Info.plist b/QRCode/Info.plist index d3de8ee..783e22e 100644 --- a/QRCode/Info.plist +++ b/QRCode/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.0 + 2.0.1 CFBundleSignature ???? CFBundleVersion From b55ab605dd556b3ef3221c35adf16e12d75a626a Mon Sep 17 00:00:00 2001 From: Dave Poirier Date: Thu, 28 Jun 2018 08:02:08 -0400 Subject: [PATCH 8/9] Xcode 9.4 Swift 4.0 Signed-off-by: Dave Poirier --- Example.xcodeproj/project.pbxproj | 36 ++++++++++++++----- .../xcshareddata/IDEWorkspaceChecks.plist | 8 +++++ .../xcshareddata/xcschemes/QRCode.xcscheme | 6 ++-- .../xcschemes/QRCodeTests.xcscheme | 2 +- 4 files changed, 39 insertions(+), 13 deletions(-) create mode 100644 Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Example.xcodeproj/project.pbxproj b/Example.xcodeproj/project.pbxproj index 042dddb..641dd0d 100644 --- a/Example.xcodeproj/project.pbxproj +++ b/Example.xcodeproj/project.pbxproj @@ -265,7 +265,7 @@ attributes = { LastSwiftMigration = 0700; LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0940; ORGANIZATIONNAME = "Alexander Schuch"; TargetAttributes = { 4D248F061A751C3700E44E6B = { @@ -407,14 +407,22 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -442,7 +450,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -454,14 +462,22 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -481,7 +497,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 4.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -490,12 +506,13 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Example/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.QRCode-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -503,12 +520,13 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = Example/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.QRCode-Example"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 4.0; }; name = Release; }; @@ -534,7 +552,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -558,7 +576,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 4.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; diff --git a/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Example.xcodeproj/xcshareddata/xcschemes/QRCode.xcscheme b/Example.xcodeproj/xcshareddata/xcschemes/QRCode.xcscheme index 820d857..636f6ca 100644 --- a/Example.xcodeproj/xcshareddata/xcschemes/QRCode.xcscheme +++ b/Example.xcodeproj/xcshareddata/xcschemes/QRCode.xcscheme @@ -1,6 +1,6 @@ + codeCoverageEnabled = "YES" + shouldUseLaunchSchemeArgsEnv = "YES"> diff --git a/Example.xcodeproj/xcshareddata/xcschemes/QRCodeTests.xcscheme b/Example.xcodeproj/xcshareddata/xcschemes/QRCodeTests.xcscheme index 44264cb..a504431 100644 --- a/Example.xcodeproj/xcshareddata/xcschemes/QRCodeTests.xcscheme +++ b/Example.xcodeproj/xcshareddata/xcschemes/QRCodeTests.xcscheme @@ -1,6 +1,6 @@ Date: Thu, 28 Jun 2018 08:15:27 -0400 Subject: [PATCH 9/9] Updated README for 2.0.1 release Signed-off-by: Dave Poirier --- README.md | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index df70343..f498264 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # QRCode 🔳 -[![Build Status](https://travis-ci.org/aschuch/QRCode.svg)](https://travis-ci.org/aschuch/QRCode) +[![Build Status](https://travis-ci.org/ekscrypto/QRCode.svg)](https://travis-ci.org/ekscrypto/QRCode) ![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat) -![Swift 3.0](https://img.shields.io/badge/Swift-3.0-orange.svg) +![Swift 4.0](https://img.shields.io/badge/Swift-4.0-orange.svg) A QRCode generator written in Swift. @@ -103,11 +103,12 @@ Current Swift compatibility breakdown: | Swift Version | Framework Version | | ------------- | ----------------- | -| 3.0 | 2.x | +| 4.0 | 2.0.1 | +| 3.0 | 2.0 | | 2.3 | 1.x | | 2.2 | 0.x | -[all releases]: https://github.com/aschuch/QRCode/releases +[all releases]: https://github.com/ekscrypto/QRCode/releases ## Installation @@ -116,7 +117,7 @@ Current Swift compatibility breakdown: Add the following line to your [Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile). ``` -github "aschuch/QRCode" +github "ekscrypto/QRCode" ``` Then run `carthage update`. @@ -126,10 +127,10 @@ Then run `carthage update`. Add the following line to your Podfile. ``` -pod "QRCode" +pod "QRCode", :git => "https://github.com/ekscrypto/QRCode.git" ``` -Then run `pod install` with Cocoapods 0.36 or newer. +Then run `pod install` with Cocoapods 1.5.3 or newer. #### Manually @@ -164,5 +165,11 @@ xctool -scheme QRCodeTests -sdk iphonesimulator test Feel free to get in touch. +Original author: * Website: * Twitter: [@schuchalexander](http://twitter.com/schuchalexander) + +Latest updates: +* Website: +* Twitter: [@ekscrypto](https://twitter.com/ekscrypto) +