Skip to content

Commit 44abb5e

Browse files
committed
Merge branch 'swift2.2'
2 parents 8c800e7 + 6ed386f commit 44abb5e

File tree

8 files changed

+71
-13
lines changed

8 files changed

+71
-13
lines changed

Example.xcodeproj/project.pbxproj

+19-1
Original file line numberDiff line numberDiff line change
@@ -265,17 +265,20 @@
265265
attributes = {
266266
LastSwiftMigration = 0700;
267267
LastSwiftUpdateCheck = 0700;
268-
LastUpgradeCheck = 0700;
268+
LastUpgradeCheck = 0800;
269269
ORGANIZATIONNAME = "Alexander Schuch";
270270
TargetAttributes = {
271271
4D248F061A751C3700E44E6B = {
272272
CreatedOnToolsVersion = 6.2;
273+
LastSwiftMigration = 0800;
273274
};
274275
4D248F301A751C7800E44E6B = {
275276
CreatedOnToolsVersion = 6.2;
277+
LastSwiftMigration = 0800;
276278
};
277279
4D248F3A1A751C7800E44E6B = {
278280
CreatedOnToolsVersion = 6.2;
281+
LastSwiftMigration = 0800;
279282
TestTargetID = 4D248F061A751C3700E44E6B;
280283
};
281284
};
@@ -409,8 +412,10 @@
409412
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
410413
CLANG_WARN_EMPTY_BODY = YES;
411414
CLANG_WARN_ENUM_CONVERSION = YES;
415+
CLANG_WARN_INFINITE_RECURSION = YES;
412416
CLANG_WARN_INT_CONVERSION = YES;
413417
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
418+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
414419
CLANG_WARN_UNREACHABLE_CODE = YES;
415420
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
416421
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -419,6 +424,7 @@
419424
ENABLE_TESTABILITY = YES;
420425
GCC_C_LANGUAGE_STANDARD = gnu99;
421426
GCC_DYNAMIC_NO_PIC = NO;
427+
GCC_NO_COMMON_BLOCKS = YES;
422428
GCC_OPTIMIZATION_LEVEL = 0;
423429
GCC_PREPROCESSOR_DEFINITIONS = (
424430
"DEBUG=1",
@@ -452,15 +458,18 @@
452458
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
453459
CLANG_WARN_EMPTY_BODY = YES;
454460
CLANG_WARN_ENUM_CONVERSION = YES;
461+
CLANG_WARN_INFINITE_RECURSION = YES;
455462
CLANG_WARN_INT_CONVERSION = YES;
456463
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
464+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
457465
CLANG_WARN_UNREACHABLE_CODE = YES;
458466
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
459467
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
460468
COPY_PHASE_STRIP = NO;
461469
ENABLE_NS_ASSERTIONS = NO;
462470
ENABLE_STRICT_OBJC_MSGSEND = YES;
463471
GCC_C_LANGUAGE_STANDARD = gnu99;
472+
GCC_NO_COMMON_BLOCKS = YES;
464473
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
465474
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
466475
GCC_WARN_UNDECLARED_SELECTOR = YES;
@@ -470,6 +479,7 @@
470479
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
471480
MTL_ENABLE_DEBUG_INFO = NO;
472481
SDKROOT = iphoneos;
482+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
473483
VALIDATE_PRODUCT = YES;
474484
};
475485
name = Release;
@@ -483,6 +493,7 @@
483493
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
484494
PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier)";
485495
PRODUCT_NAME = "$(TARGET_NAME)";
496+
SWIFT_VERSION = 2.3;
486497
};
487498
name = Debug;
488499
};
@@ -495,13 +506,15 @@
495506
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
496507
PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier)";
497508
PRODUCT_NAME = "$(TARGET_NAME)";
509+
SWIFT_VERSION = 2.3;
498510
};
499511
name = Release;
500512
};
501513
4D248F4B1A751C7800E44E6B /* Debug */ = {
502514
isa = XCBuildConfiguration;
503515
buildSettings = {
504516
CLANG_ENABLE_MODULES = YES;
517+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
505518
CURRENT_PROJECT_VERSION = 1;
506519
DEFINES_MODULE = YES;
507520
DYLIB_COMPATIBILITY_VERSION = 1;
@@ -519,6 +532,7 @@
519532
PRODUCT_NAME = "$(TARGET_NAME)";
520533
SKIP_INSTALL = YES;
521534
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
535+
SWIFT_VERSION = 2.3;
522536
TARGETED_DEVICE_FAMILY = "1,2";
523537
VERSIONING_SYSTEM = "apple-generic";
524538
VERSION_INFO_PREFIX = "";
@@ -529,6 +543,7 @@
529543
isa = XCBuildConfiguration;
530544
buildSettings = {
531545
CLANG_ENABLE_MODULES = YES;
546+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
532547
CURRENT_PROJECT_VERSION = 1;
533548
DEFINES_MODULE = YES;
534549
DYLIB_COMPATIBILITY_VERSION = 1;
@@ -541,6 +556,7 @@
541556
PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier)";
542557
PRODUCT_NAME = "$(TARGET_NAME)";
543558
SKIP_INSTALL = YES;
559+
SWIFT_VERSION = 2.3;
544560
TARGETED_DEVICE_FAMILY = "1,2";
545561
VERSIONING_SYSTEM = "apple-generic";
546562
VERSION_INFO_PREFIX = "";
@@ -559,6 +575,7 @@
559575
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
560576
PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier)";
561577
PRODUCT_NAME = "$(TARGET_NAME)";
578+
SWIFT_VERSION = 2.3;
562579
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example";
563580
};
564581
name = Debug;
@@ -571,6 +588,7 @@
571588
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
572589
PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier)";
573590
PRODUCT_NAME = "$(TARGET_NAME)";
591+
SWIFT_VERSION = 2.3;
574592
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example";
575593
};
576594
name = Release;

Example.xcodeproj/xcshareddata/xcschemes/QRCode.xcscheme

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0700"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,9 +26,29 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29-
shouldUseLaunchSchemeArgsEnv = "YES">
29+
shouldUseLaunchSchemeArgsEnv = "YES"
30+
codeCoverageEnabled = "YES">
3031
<Testables>
32+
<TestableReference
33+
skipped = "NO">
34+
<BuildableReference
35+
BuildableIdentifier = "primary"
36+
BlueprintIdentifier = "4D248F3A1A751C7800E44E6B"
37+
BuildableName = "QRCodeTests.xctest"
38+
BlueprintName = "QRCodeTests"
39+
ReferencedContainer = "container:Example.xcodeproj">
40+
</BuildableReference>
41+
</TestableReference>
3142
</Testables>
43+
<MacroExpansion>
44+
<BuildableReference
45+
BuildableIdentifier = "primary"
46+
BlueprintIdentifier = "4D248F301A751C7800E44E6B"
47+
BuildableName = "QRCode.framework"
48+
BlueprintName = "QRCode"
49+
ReferencedContainer = "container:Example.xcodeproj">
50+
</BuildableReference>
51+
</MacroExpansion>
3252
<AdditionalOptions>
3353
</AdditionalOptions>
3454
</TestAction>

Example.xcodeproj/xcshareddata/xcschemes/QRCodeTests.xcscheme

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0700"
3+
LastUpgradeVersion = "0800"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -79,6 +79,15 @@
7979
savedToolIdentifier = ""
8080
useCustomWorkingDirectory = "NO"
8181
debugDocumentVersioning = "YES">
82+
<MacroExpansion>
83+
<BuildableReference
84+
BuildableIdentifier = "primary"
85+
BlueprintIdentifier = "4D248F3A1A751C7800E44E6B"
86+
BuildableName = "QRCodeTests.xctest"
87+
BlueprintName = "QRCodeTests"
88+
ReferencedContainer = "container:Example.xcodeproj">
89+
</BuildableReference>
90+
</MacroExpansion>
8291
</ProfileAction>
8392
<AnalyzeAction
8493
buildConfiguration = "Debug">

QRCode.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "QRCode"
3-
s.version = "0.5"
3+
s.version = "1.0"
44
s.summary = "A QRCode generator written in Swift."
55
s.description = "Generate QRCodes and customize their appearance."
66
s.homepage = "https://github.com/aschuch/QRCode"

QRCode/CIImageExtension.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ internal extension CIImage {
1717
/// - parameter withScale: a given scale using to resize the result image
1818
///
1919
/// - returns: an non-interpolated UIImage
20-
internal func nonInterpolatedImage(withScale scale: Scale = Scale(dx: 1, dy: 1)) -> UIImage {
21-
let cgImage = CIContext(options: nil).createCGImage(self, fromRect: self.extent)
20+
internal func nonInterpolatedImage(withScale scale: Scale = Scale(dx: 1, dy: 1)) -> UIImage? {
21+
guard let cgImage = CIContext(options: nil).createCGImage(self, fromRect: self.extent) else { return nil }
2222
let size = CGSize(width: self.extent.size.width * scale.dx, height: self.extent.size.height * scale.dy)
2323

2424
UIGraphicsBeginImageContextWithOptions(size, true, 0)
25-
let context = UIGraphicsGetCurrentContext()
25+
guard let context = UIGraphicsGetCurrentContext() else { return nil }
2626

2727
CGContextSetInterpolationQuality(context, .None)
2828

@@ -36,4 +36,4 @@ internal extension CIImage {
3636

3737
return result
3838
}
39-
}
39+
}

QRCode/QRCode.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public struct QRCode {
6060
}
6161

6262
public init?(_ url: NSURL) {
63-
if let data = url.absoluteString.dataUsingEncoding(NSISOLatin1StringEncoding) {
63+
if let data = url.absoluteString?.dataUsingEncoding(NSISOLatin1StringEncoding) {
6464
self.data = data
6565
} else {
6666
return nil

QRCodeTests/QRCodeTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class QRCodeTests: XCTestCase {
3939

4040
func testInitWithURL() {
4141
let url = NSURL(string: "http://example.com")!
42-
let data = url.absoluteString.dataUsingEncoding(NSISOLatin1StringEncoding)!
42+
let data = url.absoluteString!.dataUsingEncoding(NSISOLatin1StringEncoding)!
4343
let qrCode = QRCode(url)
4444

4545
XCTAssert(qrCode != nil, "QRCode is nil")

README.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Build Status](https://travis-ci.org/aschuch/QRCode.svg)](https://travis-ci.org/aschuch/QRCode)
44
![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)
5-
![Swift 2.2](https://img.shields.io/badge/Swift-2.2-orange.svg)
5+
![Swift 2.3](https://img.shields.io/badge/Swift-2.2-orange.svg)
66

77
> This project is [Migrating to Swift 3](http://www.jessesquires.com/migrating-to-swift-3/).
88
> * Swift 2.3 is currently available from the [`swift2.3` branch](https://github.com/aschuch/QRCode/tree/swift2.3)
@@ -12,7 +12,7 @@ A QRCode generator written in Swift.
1212

1313
![QRCode Example](Resources/example.png)
1414

15-
## Usage
15+
## Overview
1616

1717
Create a new QRCode representing a `NSURL`, a string or arbitrary data.
1818
The following examples all result in the same QRCode image.
@@ -74,6 +74,17 @@ In case you love emoji as much as I do, make sure to create your `QRCode` instan
7474
let qrCode = 🔳("http://example.com")
7575
```
7676

77+
## Version Compatibility
78+
79+
Current Swift compatibility breakdown:
80+
81+
| Swift Version | Framework Version |
82+
| ------------- | ----------------- |
83+
| 2.3 | 1.x |
84+
| 2.2 | 0.x |
85+
86+
[all releases]: https://github.com/aschuch/QRCode/releases
87+
7788
## Installation
7889

7990
#### Carthage

0 commit comments

Comments
 (0)