diff --git a/QRIO.xcodeproj/project.pbxproj b/QRIO.xcodeproj/project.pbxproj index 319f950..07f3fc8 100644 --- a/QRIO.xcodeproj/project.pbxproj +++ b/QRIO.xcodeproj/project.pbxproj @@ -151,9 +151,11 @@ TargetAttributes = { 838FB5641D26A45E0065A950 = { CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 0800; }; 838FB56E1D26A45E0065A950 = { CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 0800; }; }; }; @@ -327,6 +329,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 2.3; }; name = Debug; }; @@ -345,6 +348,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.nodes.QRIO; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + SWIFT_VERSION = 2.3; }; name = Release; }; @@ -355,6 +359,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.nodes.QRIOTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 2.3; }; name = Debug; }; @@ -365,6 +370,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.nodes.QRIOTests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 2.3; }; name = Release; }; diff --git a/QRIO/QRIO.swift b/QRIO/QRIO.swift index 46f9e74..e723506 100644 --- a/QRIO/QRIO.swift +++ b/QRIO/QRIO.swift @@ -98,7 +98,9 @@ public extension UIImage { let qrImage = resultImage.imageByApplyingTransform(CGAffineTransformMakeScale(scaleX, scaleY)) let context = CIContext(options: nil) - let tempImage: CGImageRef = context.createCGImage(qrImage, fromRect: qrImage.extent) - return UIImage(CGImage: tempImage) + if let tempImage: CGImageRef = context.createCGImage(qrImage, fromRect: qrImage.extent) { + return UIImage(CGImage: tempImage) + } + return nil } }