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"
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 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 1.0
+ 2.0.1
CFBundleSignature
????
CFBundleVersion
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
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:
diff --git a/QRCode/CIImageExtension.swift b/QRCode/CIImageExtension.swift
index f096069..640c91d 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)
@@ -18,7 +20,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)
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
diff --git a/README.md b/README.md
index 2bb0285..f498264 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,8 @@
# QRCode 🔳
-[](https://travis-ci.org/aschuch/QRCode)
+[](https://travis-ci.org/ekscrypto/QRCode)

-
+
A QRCode generator written in Swift.
@@ -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`.
@@ -76,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
@@ -89,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`.
@@ -99,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
@@ -137,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)
+