diff --git a/.travis.yml b/.travis.yml index 99858c0..5cf7ea1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,8 @@ env: global: - LC_CTYPE=en_US.UTF-8 - LANG=en_US.UTF-8 - - PROJECT=Example.xcodeproj - - IOS_FRAMEWORK_SCHEME="QRCode" # -iOS + - PROJECT=QRCode.xcodeproj + - IOS_FRAMEWORK_SCHEME="QRCode_iOS" # -iOS #- TVOS_FRAMEWORK_SCHEME="QRCode-tvOS" #- WATCHOS_FRAMEWORK_SCHEME="QRCode-watchOS" matrix: diff --git a/Example/AppDelegate.swift b/Example_iOS/AppDelegate.swift similarity index 100% rename from Example/AppDelegate.swift rename to Example_iOS/AppDelegate.swift diff --git a/Example/Base.lproj/LaunchScreen.xib b/Example_iOS/Base.lproj/LaunchScreen.xib similarity index 57% rename from Example/Base.lproj/LaunchScreen.xib rename to Example_iOS/Base.lproj/LaunchScreen.xib index dde6076..34c6f70 100644 --- a/Example/Base.lproj/LaunchScreen.xib +++ b/Example_iOS/Base.lproj/LaunchScreen.xib @@ -1,7 +1,12 @@ - - + + + + + - + + + @@ -9,7 +14,7 @@ - + diff --git a/Example/Base.lproj/Main.storyboard b/Example_iOS/Base.lproj/Main.storyboard similarity index 92% rename from Example/Base.lproj/Main.storyboard rename to Example_iOS/Base.lproj/Main.storyboard index 80e98c3..4e7008c 100644 --- a/Example/Base.lproj/Main.storyboard +++ b/Example_iOS/Base.lproj/Main.storyboard @@ -1,7 +1,12 @@ - - + + + + + - + + + @@ -13,11 +18,11 @@ - + - + @@ -70,7 +75,7 @@ - + @@ -92,7 +97,7 @@ - + diff --git a/Example/Images.xcassets/AppIcon.appiconset/Contents.json b/Example_iOS/Images.xcassets/AppIcon.appiconset/Contents.json similarity index 77% rename from Example/Images.xcassets/AppIcon.appiconset/Contents.json rename to Example_iOS/Images.xcassets/AppIcon.appiconset/Contents.json index 118c98f..b8236c6 100644 --- a/Example/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/Example_iOS/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", diff --git a/Example/Info.plist b/Example_iOS/Info.plist similarity index 100% rename from Example/Info.plist rename to Example_iOS/Info.plist diff --git a/Example/ViewController.swift b/Example_iOS/ViewController.swift similarity index 97% rename from Example/ViewController.swift rename to Example_iOS/ViewController.swift index e3e3072..605f111 100644 --- a/Example/ViewController.swift +++ b/Example_iOS/ViewController.swift @@ -18,10 +18,9 @@ class ViewController: UIViewController { @IBOutlet weak var imageViewMedium: UIImageView! @IBOutlet weak var imageViewLarge: UIImageView! - override func viewDidLoad() { super.viewDidLoad() - + // large // default imageViewLarge.image = { @@ -30,7 +29,7 @@ class ViewController: UIViewController { qrCode.errorCorrection = .High return qrCode.image }() - + // medium // purple imageViewMedium.image = { @@ -39,7 +38,7 @@ class ViewController: UIViewController { qrCode.color = CIColor(rgba: "8e44ad") return qrCode.image }() - + // small // red (inverted) imageViewSmall1.image = { @@ -49,7 +48,7 @@ class ViewController: UIViewController { qrCode.backgroundColor = CIColor(rgba: "e74c3c") return qrCode.image }() - + // small // green imageViewSmall2.image = { @@ -59,7 +58,7 @@ class ViewController: UIViewController { qrCode.backgroundColor = CIColor(rgba: "000") return qrCode.image }() - + // small // orange imageViewSmall3.image = { @@ -70,7 +69,6 @@ class ViewController: UIViewController { return qrCode.image }() - // small // blue imageViewSmall4.image = { diff --git a/Example_macOS/AppDelegate.swift b/Example_macOS/AppDelegate.swift new file mode 100644 index 0000000..3a2e335 --- /dev/null +++ b/Example_macOS/AppDelegate.swift @@ -0,0 +1,23 @@ +// +// AppDelegate.swift +// Example_macOS +// +// Created by Maximilian Blochberger on 2017-08-09. +// Copyright © 2017 Alexander Schuch. All rights reserved. +// + +import Cocoa + +@NSApplicationMain +class AppDelegate: NSObject, NSApplicationDelegate { + + func applicationDidFinishLaunching(_ aNotification: Notification) { + // Insert code here to initialize your application + } + + func applicationWillTerminate(_ aNotification: Notification) { + // Insert code here to tear down your application + } + +} + diff --git a/Example_macOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example_macOS/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..2db2b1c --- /dev/null +++ b/Example_macOS/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Example_macOS/Base.lproj/Main.storyboard b/Example_macOS/Base.lproj/Main.storyboard new file mode 100644 index 0000000..1622f55 --- /dev/null +++ b/Example_macOS/Base.lproj/Main.storyboard @@ -0,0 +1,737 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example_macOS/Info.plist b/Example_macOS/Info.plist new file mode 100644 index 0000000..1336bb2 --- /dev/null +++ b/Example_macOS/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + Copyright © 2017 Alexander Schuch. All rights reserved. + NSMainStoryboardFile + Main + NSPrincipalClass + NSApplication + + diff --git a/Example_macOS/ViewController.swift b/Example_macOS/ViewController.swift new file mode 100644 index 0000000..64bb174 --- /dev/null +++ b/Example_macOS/ViewController.swift @@ -0,0 +1,83 @@ +// +// ViewController.swift +// Example_macOS +// +// Created by Maximilian Blochberger on 2017-08-09. +// Copyright © 2017 Alexander Schuch. All rights reserved. +// + +import Cocoa +import QRCode + +class ViewController: NSViewController { + + @IBOutlet weak var imageViewSmall1: NSImageView! + @IBOutlet weak var imageViewSmall2: NSImageView! + @IBOutlet weak var imageViewSmall3: NSImageView! + @IBOutlet weak var imageViewSmall4: NSImageView! + @IBOutlet weak var imageViewMedium: NSImageView! + @IBOutlet weak var imageViewLarge: NSImageView! + + override func viewDidLoad() { + super.viewDidLoad() + + // large + // default + imageViewLarge.image = { + var qrCode = QRCode("http://github.com/aschuch/QRCode")! + qrCode.size = self.imageViewLarge.bounds.size + qrCode.errorCorrection = .High + return qrCode.image + }() + + // medium + // purple + imageViewMedium.image = { + var qrCode = QRCode("http://schuch.me")! + qrCode.size = self.imageViewMedium.bounds.size + qrCode.color = CIColor(rgba: "8e44ad") + return qrCode.image + }() + + // small + // red (inverted) + imageViewSmall1.image = { + var qrCode = QRCode("http://objc.at")! + qrCode.size = self.imageViewSmall1.bounds.size + qrCode.color = CIColor(rgba: "fff") + qrCode.backgroundColor = CIColor(rgba: "e74c3c") + return qrCode.image + }() + + // small + // green + imageViewSmall2.image = { + var qrCode = QRCode("http://apple.com")! + qrCode.size = self.imageViewSmall1.bounds.size + qrCode.color = CIColor(rgba: "16a085") + qrCode.backgroundColor = CIColor(rgba: "000") + return qrCode.image + }() + + // small + // orange + imageViewSmall3.image = { + var qrCode = QRCode("http://example.com")! + qrCode.size = self.imageViewSmall1.bounds.size + qrCode.color = CIColor(rgba: "c0392b") + qrCode.backgroundColor = CIColor(rgba: "f1c40f") + return qrCode.image + }() + + // small + // blue + imageViewSmall4.image = { + var qrCode = QRCode("http://example.com")! + qrCode.size = self.imageViewSmall1.bounds.size + qrCode.color = CIColor(rgba: "2980b9") + return qrCode.image + }() + } + +} + diff --git a/Example.xcodeproj/project.pbxproj b/QRCode.xcodeproj/project.pbxproj similarity index 53% rename from Example.xcodeproj/project.pbxproj rename to QRCode.xcodeproj/project.pbxproj index 042dddb..d664c66 100644 --- a/Example.xcodeproj/project.pbxproj +++ b/QRCode.xcodeproj/project.pbxproj @@ -15,11 +15,23 @@ 4D248F361A751C7800E44E6B /* QRCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D248F351A751C7800E44E6B /* QRCode.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4D248F3C1A751C7800E44E6B /* QRCode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D248F311A751C7800E44E6B /* QRCode.framework */; }; 4D248F451A751C7800E44E6B /* QRCodeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D248F441A751C7800E44E6B /* QRCodeTests.swift */; }; - 4D248F481A751C7800E44E6B /* QRCode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D248F311A751C7800E44E6B /* QRCode.framework */; }; - 4D248F491A751C7800E44E6B /* QRCode.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4D248F311A751C7800E44E6B /* QRCode.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 4D248F521A751CE300E44E6B /* QRCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D248F511A751CE300E44E6B /* QRCode.swift */; }; 4D9240641A78050C0069D66D /* UIImageViewExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D9240631A78050C0069D66D /* UIImageViewExtension.swift */; }; 4D9240661A7805310069D66D /* CIColorExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D9240651A7805310069D66D /* CIColorExtension.swift */; }; + 60940CEA1F3B75AB00725D98 /* QRCode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 60940CE11F3B75AB00725D98 /* QRCode.framework */; }; + 60940CF81F3B75DA00725D98 /* QRCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D248F511A751CE300E44E6B /* QRCode.swift */; }; + 60940CFA1F3B75E100725D98 /* CIColorExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D9240651A7805310069D66D /* CIColorExtension.swift */; }; + 60940CFB1F3B75E400725D98 /* CIImageExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA24AF3D1C247A7C00D1BEC7 /* CIImageExtension.swift */; }; + 60940CFC1F3B75E700725D98 /* QRCode.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D248F351A751C7800E44E6B /* QRCode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 60940CFD1F3B75F800725D98 /* QRCodeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D248F441A751C7800E44E6B /* QRCodeTests.swift */; }; + 60940D051F3B814300725D98 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60940D041F3B814300725D98 /* AppDelegate.swift */; }; + 60940D071F3B814300725D98 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60940D061F3B814300725D98 /* ViewController.swift */; }; + 60940D091F3B814300725D98 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 60940D081F3B814300725D98 /* Assets.xcassets */; }; + 60940D0C1F3B814300725D98 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 60940D0A1F3B814300725D98 /* Main.storyboard */; }; + 60940D111F3B836600725D98 /* QRCode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 60940CE11F3B75AB00725D98 /* QRCode.framework */; }; + 60940D121F3B836600725D98 /* QRCode.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 60940CE11F3B75AB00725D98 /* QRCode.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 60CA86781F3BC32900E844B2 /* QRCode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D248F311A751C7800E44E6B /* QRCode.framework */; }; + 60CA86791F3BC32900E844B2 /* QRCode.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4D248F311A751C7800E44E6B /* QRCode.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; AA24AF3E1C247A7C00D1BEC7 /* CIImageExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA24AF3D1C247A7C00D1BEC7 /* CIImageExtension.swift */; }; /* End PBXBuildFile section */ @@ -31,30 +43,55 @@ remoteGlobalIDString = 4D248F301A751C7800E44E6B; remoteInfo = QRCode; }; - 4D248F3F1A751C7800E44E6B /* PBXContainerItemProxy */ = { + 4D248F461A751C7800E44E6B /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 4D248EFF1A751C3700E44E6B /* Project object */; proxyType = 1; - remoteGlobalIDString = 4D248F061A751C3700E44E6B; - remoteInfo = Example; + remoteGlobalIDString = 60940CE01F3B75AB00725D98; + remoteInfo = QRCode_macOS; }; - 4D248F461A751C7800E44E6B /* PBXContainerItemProxy */ = { + 60940D131F3B836600725D98 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4D248EFF1A751C3700E44E6B /* Project object */; + proxyType = 1; + remoteGlobalIDString = 60940CE01F3B75AB00725D98; + remoteInfo = QRCode_macOS; + }; + 60CA86771F3BC0FF00E844B2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4D248EFF1A751C3700E44E6B /* Project object */; + proxyType = 1; + remoteGlobalIDString = 60940CE01F3B75AB00725D98; + remoteInfo = QRCode_macOS; + }; + 60CA867A1F3BC32900E844B2 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 4D248EFF1A751C3700E44E6B /* Project object */; proxyType = 1; remoteGlobalIDString = 4D248F301A751C7800E44E6B; - remoteInfo = QRCode; + remoteInfo = QRCode_iOS; }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ - 4D248F4D1A751C7800E44E6B /* Embed Frameworks */ = { + 60940D151F3B836600725D98 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 10; files = ( - 4D248F491A751C7800E44E6B /* QRCode.framework in Embed Frameworks */, + 60940D121F3B836600725D98 /* QRCode.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + 60CA867C1F3BC32900E844B2 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 60CA86791F3BC32900E844B2 /* QRCode.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -72,12 +109,20 @@ 4D248F311A751C7800E44E6B /* QRCode.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = QRCode.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 4D248F341A751C7800E44E6B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 4D248F351A751C7800E44E6B /* QRCode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QRCode.h; sourceTree = ""; }; - 4D248F3B1A751C7800E44E6B /* QRCodeTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = QRCodeTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 4D248F3B1A751C7800E44E6B /* QRCodeTests_iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = QRCodeTests_iOS.xctest; path = QRCodeTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 4D248F431A751C7800E44E6B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 4D248F441A751C7800E44E6B /* QRCodeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRCodeTests.swift; sourceTree = ""; }; 4D248F511A751CE300E44E6B /* QRCode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QRCode.swift; sourceTree = ""; }; 4D9240631A78050C0069D66D /* UIImageViewExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIImageViewExtension.swift; sourceTree = ""; }; 4D9240651A7805310069D66D /* CIColorExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CIColorExtension.swift; sourceTree = ""; }; + 60940CE11F3B75AB00725D98 /* QRCode.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = QRCode.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 60940CE91F3B75AB00725D98 /* QRCodeTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = QRCodeTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 60940D021F3B814300725D98 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 60940D041F3B814300725D98 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 60940D061F3B814300725D98 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 60940D081F3B814300725D98 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 60940D0B1F3B814300725D98 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 60940D0D1F3B814300725D98 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; AA24AF3D1C247A7C00D1BEC7 /* CIImageExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CIImageExtension.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -86,7 +131,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 4D248F481A751C7800E44E6B /* QRCode.framework in Frameworks */, + 60CA86781F3BC32900E844B2 /* QRCode.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -105,13 +150,37 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 60940CDD1F3B75AB00725D98 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 60940CE61F3B75AB00725D98 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 60940CEA1F3B75AB00725D98 /* QRCode.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 60940CFF1F3B814300725D98 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 60940D111F3B836600725D98 /* QRCode.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 4D248EFE1A751C3700E44E6B = { isa = PBXGroup; children = ( - 4D248F091A751C3700E44E6B /* Example */, + 4D248F091A751C3700E44E6B /* Example_iOS */, + 60940D031F3B814300725D98 /* Example_macOS */, 4D248F321A751C7800E44E6B /* QRCode */, 4D248F411A751C7800E44E6B /* QRCodeTests */, 4D248F081A751C3700E44E6B /* Products */, @@ -123,12 +192,15 @@ children = ( 4D248F071A751C3700E44E6B /* Example.app */, 4D248F311A751C7800E44E6B /* QRCode.framework */, - 4D248F3B1A751C7800E44E6B /* QRCodeTests.xctest */, + 4D248F3B1A751C7800E44E6B /* QRCodeTests_iOS.xctest */, + 60940CE11F3B75AB00725D98 /* QRCode.framework */, + 60940CE91F3B75AB00725D98 /* QRCodeTests.xctest */, + 60940D021F3B814300725D98 /* Example.app */, ); name = Products; sourceTree = ""; }; - 4D248F091A751C3700E44E6B /* Example */ = { + 4D248F091A751C3700E44E6B /* Example_iOS */ = { isa = PBXGroup; children = ( 4D248F0C1A751C3700E44E6B /* AppDelegate.swift */, @@ -138,7 +210,7 @@ 4D248F151A751C3700E44E6B /* LaunchScreen.xib */, 4D248F0A1A751C3700E44E6B /* Supporting Files */, ); - path = Example; + path = Example_iOS; sourceTree = ""; }; 4D248F0A1A751C3700E44E6B /* Supporting Files */ = { @@ -187,6 +259,18 @@ name = "Supporting Files"; sourceTree = ""; }; + 60940D031F3B814300725D98 /* Example_macOS */ = { + isa = PBXGroup; + children = ( + 60940D041F3B814300725D98 /* AppDelegate.swift */, + 60940D061F3B814300725D98 /* ViewController.swift */, + 60940D081F3B814300725D98 /* Assets.xcassets */, + 60940D0A1F3B814300725D98 /* Main.storyboard */, + 60940D0D1F3B814300725D98 /* Info.plist */, + ); + path = Example_macOS; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -198,31 +282,40 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 60940CDE1F3B75AB00725D98 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 60940CFC1F3B75E700725D98 /* QRCode.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 4D248F061A751C3700E44E6B /* Example */ = { + 4D248F061A751C3700E44E6B /* Example_iOS */ = { isa = PBXNativeTarget; - buildConfigurationList = 4D248F261A751C3700E44E6B /* Build configuration list for PBXNativeTarget "Example" */; + buildConfigurationList = 4D248F261A751C3700E44E6B /* Build configuration list for PBXNativeTarget "Example_iOS" */; buildPhases = ( 4D248F031A751C3700E44E6B /* Sources */, 4D248F041A751C3700E44E6B /* Frameworks */, 4D248F051A751C3700E44E6B /* Resources */, - 4D248F4D1A751C7800E44E6B /* Embed Frameworks */, + 60CA867C1F3BC32900E844B2 /* Embed Frameworks */, ); buildRules = ( ); dependencies = ( 4D248F471A751C7800E44E6B /* PBXTargetDependency */, + 60CA867B1F3BC32900E844B2 /* PBXTargetDependency */, ); - name = Example; + name = Example_iOS; productName = Example; productReference = 4D248F071A751C3700E44E6B /* Example.app */; productType = "com.apple.product-type.application"; }; - 4D248F301A751C7800E44E6B /* QRCode */ = { + 4D248F301A751C7800E44E6B /* QRCode_iOS */ = { isa = PBXNativeTarget; - buildConfigurationList = 4D248F4A1A751C7800E44E6B /* Build configuration list for PBXNativeTarget "QRCode" */; + buildConfigurationList = 4D248F4A1A751C7800E44E6B /* Build configuration list for PBXNativeTarget "QRCode_iOS" */; buildPhases = ( 4D248F2C1A751C7800E44E6B /* Sources */, 4D248F2D1A751C7800E44E6B /* Frameworks */, @@ -233,14 +326,14 @@ ); dependencies = ( ); - name = QRCode; + name = QRCode_iOS; productName = QRCode; productReference = 4D248F311A751C7800E44E6B /* QRCode.framework */; productType = "com.apple.product-type.framework"; }; - 4D248F3A1A751C7800E44E6B /* QRCodeTests */ = { + 4D248F3A1A751C7800E44E6B /* QRCodeTests_iOS */ = { isa = PBXNativeTarget; - buildConfigurationList = 4D248F4E1A751C7800E44E6B /* Build configuration list for PBXNativeTarget "QRCodeTests" */; + buildConfigurationList = 4D248F4E1A751C7800E44E6B /* Build configuration list for PBXNativeTarget "QRCodeTests_iOS" */; buildPhases = ( 4D248F371A751C7800E44E6B /* Sources */, 4D248F381A751C7800E44E6B /* Frameworks */, @@ -250,13 +343,67 @@ ); dependencies = ( 4D248F3E1A751C7800E44E6B /* PBXTargetDependency */, - 4D248F401A751C7800E44E6B /* PBXTargetDependency */, ); - name = QRCodeTests; + name = QRCodeTests_iOS; productName = QRCodeTests; - productReference = 4D248F3B1A751C7800E44E6B /* QRCodeTests.xctest */; + productReference = 4D248F3B1A751C7800E44E6B /* QRCodeTests_iOS.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + 60940CE01F3B75AB00725D98 /* QRCode_macOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 60940CF21F3B75AB00725D98 /* Build configuration list for PBXNativeTarget "QRCode_macOS" */; + buildPhases = ( + 60940CDC1F3B75AB00725D98 /* Sources */, + 60940CDD1F3B75AB00725D98 /* Frameworks */, + 60940CDE1F3B75AB00725D98 /* Headers */, + 60940CDF1F3B75AB00725D98 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = QRCode_macOS; + productName = QRCode_macOS; + productReference = 60940CE11F3B75AB00725D98 /* QRCode.framework */; + productType = "com.apple.product-type.framework"; + }; + 60940CE81F3B75AB00725D98 /* QRCodeTests_macOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 60940CF51F3B75AB00725D98 /* Build configuration list for PBXNativeTarget "QRCodeTests_macOS" */; + buildPhases = ( + 60940CE51F3B75AB00725D98 /* Sources */, + 60940CE61F3B75AB00725D98 /* Frameworks */, + 60940CE71F3B75AB00725D98 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 60940CEC1F3B75AB00725D98 /* PBXTargetDependency */, + ); + name = QRCodeTests_macOS; + productName = QRCode_macOSTests; + productReference = 60940CE91F3B75AB00725D98 /* QRCodeTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 60940D011F3B814300725D98 /* Example_macOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 60940D0E1F3B814300725D98 /* Build configuration list for PBXNativeTarget "Example_macOS" */; + buildPhases = ( + 60940CFE1F3B814300725D98 /* Sources */, + 60940CFF1F3B814300725D98 /* Frameworks */, + 60940D001F3B814300725D98 /* Resources */, + 60940D151F3B836600725D98 /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 60940D141F3B836600725D98 /* PBXTargetDependency */, + ); + name = Example_macOS; + productName = Example_macOS; + productReference = 60940D021F3B814300725D98 /* Example.app */; + productType = "com.apple.product-type.application"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -264,7 +411,7 @@ isa = PBXProject; attributes = { LastSwiftMigration = 0700; - LastSwiftUpdateCheck = 0700; + LastSwiftUpdateCheck = 0830; LastUpgradeCheck = 0800; ORGANIZATIONNAME = "Alexander Schuch"; TargetAttributes = { @@ -281,9 +428,21 @@ LastSwiftMigration = 0800; TestTargetID = 4D248F061A751C3700E44E6B; }; + 60940CE01F3B75AB00725D98 = { + CreatedOnToolsVersion = 8.3.3; + ProvisioningStyle = Automatic; + }; + 60940CE81F3B75AB00725D98 = { + CreatedOnToolsVersion = 8.3.3; + ProvisioningStyle = Automatic; + }; + 60940D011F3B814300725D98 = { + CreatedOnToolsVersion = 8.3.3; + ProvisioningStyle = Automatic; + }; }; }; - buildConfigurationList = 4D248F021A751C3700E44E6B /* Build configuration list for PBXProject "Example" */; + buildConfigurationList = 4D248F021A751C3700E44E6B /* Build configuration list for PBXProject "QRCode" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; @@ -296,9 +455,12 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 4D248F061A751C3700E44E6B /* Example */, - 4D248F301A751C7800E44E6B /* QRCode */, - 4D248F3A1A751C7800E44E6B /* QRCodeTests */, + 4D248F061A751C3700E44E6B /* Example_iOS */, + 4D248F301A751C7800E44E6B /* QRCode_iOS */, + 4D248F3A1A751C7800E44E6B /* QRCodeTests_iOS */, + 60940D011F3B814300725D98 /* Example_macOS */, + 60940CE01F3B75AB00725D98 /* QRCode_macOS */, + 60940CE81F3B75AB00725D98 /* QRCodeTests_macOS */, ); }; /* End PBXProject section */ @@ -328,6 +490,29 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 60940CDF1F3B75AB00725D98 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 60940CE71F3B75AB00725D98 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 60940D001F3B814300725D98 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 60940D091F3B814300725D98 /* Assets.xcassets in Resources */, + 60940D0C1F3B814300725D98 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -359,24 +544,61 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 60940CDC1F3B75AB00725D98 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 60940CFB1F3B75E400725D98 /* CIImageExtension.swift in Sources */, + 60940CF81F3B75DA00725D98 /* QRCode.swift in Sources */, + 60940CFA1F3B75E100725D98 /* CIColorExtension.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 60940CE51F3B75AB00725D98 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 60940CFD1F3B75F800725D98 /* QRCodeTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 60940CFE1F3B814300725D98 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 60940D071F3B814300725D98 /* ViewController.swift in Sources */, + 60940D051F3B814300725D98 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ 4D248F3E1A751C7800E44E6B /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 4D248F301A751C7800E44E6B /* QRCode */; + target = 4D248F301A751C7800E44E6B /* QRCode_iOS */; targetProxy = 4D248F3D1A751C7800E44E6B /* PBXContainerItemProxy */; }; - 4D248F401A751C7800E44E6B /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 4D248F061A751C3700E44E6B /* Example */; - targetProxy = 4D248F3F1A751C7800E44E6B /* PBXContainerItemProxy */; - }; 4D248F471A751C7800E44E6B /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 4D248F301A751C7800E44E6B /* QRCode */; + target = 60940CE01F3B75AB00725D98 /* QRCode_macOS */; targetProxy = 4D248F461A751C7800E44E6B /* PBXContainerItemProxy */; }; + 60940CEC1F3B75AB00725D98 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 60940CE01F3B75AB00725D98 /* QRCode_macOS */; + targetProxy = 60CA86771F3BC0FF00E844B2 /* PBXContainerItemProxy */; + }; + 60940D141F3B836600725D98 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 60940CE01F3B75AB00725D98 /* QRCode_macOS */; + targetProxy = 60940D131F3B836600725D98 /* PBXContainerItemProxy */; + }; + 60CA867B1F3BC32900E844B2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4D248F301A751C7800E44E6B /* QRCode_iOS */; + targetProxy = 60CA867A1F3BC32900E844B2 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -396,6 +618,14 @@ name = LaunchScreen.xib; sourceTree = ""; }; + 60940D0A1F3B814300725D98 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 60940D0B1F3B814300725D98 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -489,12 +719,13 @@ 4D248F271A751C3700E44E6B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = Example/Info.plist; + INFOPLIST_FILE = Example_iOS/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier).iOS"; + PRODUCT_NAME = Example; SWIFT_VERSION = 3.0.1; }; name = Debug; @@ -502,12 +733,13 @@ 4D248F281A751C3700E44E6B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = Example/Info.plist; + INFOPLIST_FILE = Example_iOS/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier).iOS"; + PRODUCT_NAME = Example; SWIFT_VERSION = 3.0.1; }; name = Release; @@ -522,16 +754,12 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); INFOPLIST_FILE = QRCode/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier).iOS"; + PRODUCT_NAME = QRCode; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 3.0.1; @@ -555,8 +783,8 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier).iOS"; + PRODUCT_NAME = QRCode; SKIP_INSTALL = YES; SWIFT_VERSION = 3.0.1; TARGETED_DEVICE_FAMILY = "1,2"; @@ -569,16 +797,11 @@ isa = XCBuildConfiguration; buildSettings = { FRAMEWORK_SEARCH_PATHS = ""; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); INFOPLIST_FILE = QRCodeTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier).iOS"; + PRODUCT_NAME = QRCodeTests; SWIFT_VERSION = 3.0.1; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; }; name = Debug; }; @@ -588,17 +811,159 @@ FRAMEWORK_SEARCH_PATHS = ""; INFOPLIST_FILE = QRCodeTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; + PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier).iOS"; + PRODUCT_NAME = QRCodeTests; SWIFT_VERSION = 3.0.1; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example"; + }; + name = Release; + }; + 60940CF31F3B75AB00725D98 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = QRCode/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.12; + PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier).macOS"; + PRODUCT_NAME = QRCode; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_VERSION = 3.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 60940CF41F3B75AB00725D98 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = QRCode/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.12; + PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier).macOS"; + PRODUCT_NAME = QRCode; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 60940CF61F3B75AB00725D98 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + INFOPLIST_FILE = QRCodeTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.12; + PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier).macOS"; + PRODUCT_NAME = QRCodeTests; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + 60940CF71F3B75AB00725D98 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + INFOPLIST_FILE = QRCodeTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.12; + PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier).macOS"; + PRODUCT_NAME = QRCodeTests; + SDKROOT = macosx; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; + 60940D0F1F3B814300725D98 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + INFOPLIST_FILE = Example_macOS/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.12; + PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier).macOS"; + PRODUCT_NAME = Example; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + 60940D101F3B814300725D98 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + INFOPLIST_FILE = Example_macOS/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.12; + PRODUCT_BUNDLE_IDENTIFIER = "com.aschuch.$(PRODUCT_NAME:rfc1034identifier).macOS"; + PRODUCT_NAME = Example; + SDKROOT = macosx; + SWIFT_VERSION = 3.0; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 4D248F021A751C3700E44E6B /* Build configuration list for PBXProject "Example" */ = { + 4D248F021A751C3700E44E6B /* Build configuration list for PBXProject "QRCode" */ = { isa = XCConfigurationList; buildConfigurations = ( 4D248F241A751C3700E44E6B /* Debug */, @@ -607,7 +972,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 4D248F261A751C3700E44E6B /* Build configuration list for PBXNativeTarget "Example" */ = { + 4D248F261A751C3700E44E6B /* Build configuration list for PBXNativeTarget "Example_iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( 4D248F271A751C3700E44E6B /* Debug */, @@ -616,7 +981,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 4D248F4A1A751C7800E44E6B /* Build configuration list for PBXNativeTarget "QRCode" */ = { + 4D248F4A1A751C7800E44E6B /* Build configuration list for PBXNativeTarget "QRCode_iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( 4D248F4B1A751C7800E44E6B /* Debug */, @@ -625,7 +990,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 4D248F4E1A751C7800E44E6B /* Build configuration list for PBXNativeTarget "QRCodeTests" */ = { + 4D248F4E1A751C7800E44E6B /* Build configuration list for PBXNativeTarget "QRCodeTests_iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( 4D248F4F1A751C7800E44E6B /* Debug */, @@ -634,6 +999,33 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 60940CF21F3B75AB00725D98 /* Build configuration list for PBXNativeTarget "QRCode_macOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 60940CF31F3B75AB00725D98 /* Debug */, + 60940CF41F3B75AB00725D98 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 60940CF51F3B75AB00725D98 /* Build configuration list for PBXNativeTarget "QRCodeTests_macOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 60940CF61F3B75AB00725D98 /* Debug */, + 60940CF71F3B75AB00725D98 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 60940D0E1F3B814300725D98 /* Build configuration list for PBXNativeTarget "Example_macOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 60940D0F1F3B814300725D98 /* Debug */, + 60940D101F3B814300725D98 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 4D248EFF1A751C3700E44E6B /* Project object */; diff --git a/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/QRCode.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 71% rename from Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to QRCode.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 6d2a51b..034c9dc 100644 --- a/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/QRCode.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:QRCode.xcodeproj"> diff --git a/QRCode.xcodeproj/xcshareddata/xcschemes/Example_iOS.xcscheme b/QRCode.xcodeproj/xcshareddata/xcschemes/Example_iOS.xcscheme new file mode 100644 index 0000000..130614b --- /dev/null +++ b/QRCode.xcodeproj/xcshareddata/xcschemes/Example_iOS.xcscheme @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/QRCode.xcodeproj/xcshareddata/xcschemes/Example_macOS.xcscheme b/QRCode.xcodeproj/xcshareddata/xcschemes/Example_macOS.xcscheme new file mode 100644 index 0000000..0fa2255 --- /dev/null +++ b/QRCode.xcodeproj/xcshareddata/xcschemes/Example_macOS.xcscheme @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example.xcodeproj/xcshareddata/xcschemes/QRCodeTests.xcscheme b/QRCode.xcodeproj/xcshareddata/xcschemes/QRCodeTests_iOS.xcscheme similarity index 69% rename from Example.xcodeproj/xcshareddata/xcschemes/QRCodeTests.xcscheme rename to QRCode.xcodeproj/xcshareddata/xcschemes/QRCodeTests_iOS.xcscheme index 44264cb..4353553 100644 --- a/Example.xcodeproj/xcshareddata/xcschemes/QRCodeTests.xcscheme +++ b/QRCode.xcodeproj/xcshareddata/xcschemes/QRCodeTests_iOS.xcscheme @@ -16,8 +16,8 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "4D248F3A1A751C7800E44E6B" BuildableName = "QRCodeTests.xctest" - BlueprintName = "QRCodeTests" - ReferencedContainer = "container:Example.xcodeproj"> + BlueprintName = "QRCodeTests_iOS" + ReferencedContainer = "container:QRCode.xcodeproj"> @@ -28,24 +28,14 @@ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> - - - - + BlueprintName = "QRCodeTests_iOS" + ReferencedContainer = "container:QRCode.xcodeproj"> @@ -66,8 +56,8 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "4D248F3A1A751C7800E44E6B" BuildableName = "QRCodeTests.xctest" - BlueprintName = "QRCodeTests" - ReferencedContainer = "container:Example.xcodeproj"> + BlueprintName = "QRCodeTests_iOS" + ReferencedContainer = "container:QRCode.xcodeproj"> @@ -79,15 +69,6 @@ savedToolIdentifier = "" useCustomWorkingDirectory = "NO" debugDocumentVersioning = "YES"> - - - - diff --git a/QRCode.xcodeproj/xcshareddata/xcschemes/QRCodeTests_macOS.xcscheme b/QRCode.xcodeproj/xcshareddata/xcschemes/QRCodeTests_macOS.xcscheme new file mode 100644 index 0000000..1875c16 --- /dev/null +++ b/QRCode.xcodeproj/xcshareddata/xcschemes/QRCodeTests_macOS.xcscheme @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example.xcodeproj/xcshareddata/xcschemes/QRCode.xcscheme b/QRCode.xcodeproj/xcshareddata/xcschemes/QRCode_iOS.xcscheme similarity index 84% rename from Example.xcodeproj/xcshareddata/xcschemes/QRCode.xcscheme rename to QRCode.xcodeproj/xcshareddata/xcschemes/QRCode_iOS.xcscheme index 820d857..0ca615f 100644 --- a/Example.xcodeproj/xcshareddata/xcschemes/QRCode.xcscheme +++ b/QRCode.xcodeproj/xcshareddata/xcschemes/QRCode_iOS.xcscheme @@ -1,6 +1,6 @@ + BlueprintName = "QRCode_iOS" + ReferencedContainer = "container:QRCode.xcodeproj"> @@ -35,8 +35,8 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "4D248F3A1A751C7800E44E6B" BuildableName = "QRCodeTests.xctest" - BlueprintName = "QRCodeTests" - ReferencedContainer = "container:Example.xcodeproj"> + BlueprintName = "QRCodeTests_iOS" + ReferencedContainer = "container:QRCode.xcodeproj"> @@ -45,8 +45,8 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "4D248F301A751C7800E44E6B" BuildableName = "QRCode.framework" - BlueprintName = "QRCode" - ReferencedContainer = "container:Example.xcodeproj"> + BlueprintName = "QRCode_iOS" + ReferencedContainer = "container:QRCode.xcodeproj"> @@ -67,8 +67,8 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "4D248F301A751C7800E44E6B" BuildableName = "QRCode.framework" - BlueprintName = "QRCode" - ReferencedContainer = "container:Example.xcodeproj"> + BlueprintName = "QRCode_iOS" + ReferencedContainer = "container:QRCode.xcodeproj"> @@ -85,8 +85,8 @@ BuildableIdentifier = "primary" BlueprintIdentifier = "4D248F301A751C7800E44E6B" BuildableName = "QRCode.framework" - BlueprintName = "QRCode" - ReferencedContainer = "container:Example.xcodeproj"> + BlueprintName = "QRCode_iOS" + ReferencedContainer = "container:QRCode.xcodeproj"> diff --git a/QRCode.xcodeproj/xcshareddata/xcschemes/QRCode_macOS.xcscheme b/QRCode.xcodeproj/xcshareddata/xcschemes/QRCode_macOS.xcscheme new file mode 100644 index 0000000..e02cf31 --- /dev/null +++ b/QRCode.xcodeproj/xcshareddata/xcschemes/QRCode_macOS.xcscheme @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/QRCode/CIColorExtension.swift b/QRCode/CIColorExtension.swift index 40b4435..03565bb 100644 --- a/QRCode/CIColorExtension.swift +++ b/QRCode/CIColorExtension.swift @@ -6,10 +6,10 @@ // Copyright (c) 2015 Alexander Schuch. All rights reserved. // -import UIKit +import CoreImage public extension CIColor { - + /// Creates a CIColor from an rgba string /// /// E.g. @@ -24,13 +24,13 @@ public extension CIColor { var g: CGFloat = 0.0 var b: CGFloat = 0.0 var a: CGFloat = 1.0 - + let scanner = Scanner(string: rgba) var hexValue: CUnsignedLongLong = 0 - + if scanner.scanHexInt64(&hexValue) { let length = rgba.characters.count - + switch (length) { case 3: r = CGFloat((hexValue & 0xF00) >> 8) / 15.0 @@ -53,12 +53,12 @@ public extension CIColor { default: print("Invalid number of values (\(length)) in HEX string. Make sure to enter 3, 4, 6 or 8 values. E.g. `aabbccff`") } - + } else { print("Invalid HEX value: \(rgba)") } - + self.init(red: r, green: g, blue: b, alpha: a) } - + } diff --git a/QRCode/CIImageExtension.swift b/QRCode/CIImageExtension.swift index f096069..a091038 100644 --- a/QRCode/CIImageExtension.swift +++ b/QRCode/CIImageExtension.swift @@ -6,30 +6,52 @@ // Copyright © 2015 Alexander Schuch. All rights reserved. // -import Foundation +#if os(iOS) + import UIKit + + public typealias Image = UIImage +#endif // iOS + +#if os(OSX) + import Cocoa + + public typealias Image = NSImage +#endif // macOS internal typealias Scale = (dx: CGFloat, dy: CGFloat) internal extension CIImage { - - /// Creates an `UIImage` with interpolation disabled and scaled given a scale property + + /// Creates an `UIImage` (iOS) / `NSImage` (macOS) with interpolation disabled and scaled given a scale property /// /// - parameter withScale: a given scale using to resize the result image /// - /// - returns: an non-interpolated UIImage - internal func nonInterpolatedImage(withScale scale: Scale = Scale(dx: 1, dy: 1)) -> UIImage? { + /// - returns: an non-interpolated `UIImage`/`NSImage` + internal func nonInterpolatedImage(withScale scale: Scale = Scale(dx: 1, dy: 1)) -> Image? { guard let cgImage = CIContext(options: nil).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) - guard let context = UIGraphicsGetCurrentContext() else { return nil } - context.interpolationQuality = .none - context.translateBy(x: 0, y: size.height) - context.scaleBy(x: 1.0, y: -1.0) - context.draw(cgImage, in: context.boundingBoxOfClipPath) - let result = UIGraphicsGetImageFromCurrentImageContext() - UIGraphicsEndImageContext() - + + #if os(iOS) + UIGraphicsBeginImageContextWithOptions(size, true, 0) + guard let context = UIGraphicsGetCurrentContext() else { return nil } + context.interpolationQuality = .none + context.translateBy(x: 0, y: size.height) + context.scaleBy(x: 1.0, y: -1.0) + context.draw(cgImage, in: context.boundingBoxOfClipPath) + let result = UIGraphicsGetImageFromCurrentImageContext() + UIGraphicsEndImageContext() + #endif // iOS + + #if os(OSX) + let source = NSImage(cgImage: cgImage, size: self.extent.size) + let result = NSImage(size: size) + result.lockFocus() + guard let context = NSGraphicsContext.current() else { return nil } + context.imageInterpolation = .none + source.draw(in: CGRect(origin: CGPoint(x: 0, y: 0), size: size), from: extent, operation: .copy, fraction: 1.0) + result.unlockFocus() + #endif // macOS + return result } } diff --git a/QRCode/QRCode.h b/QRCode/QRCode.h index 054e49b..216bd4e 100644 --- a/QRCode/QRCode.h +++ b/QRCode/QRCode.h @@ -6,7 +6,7 @@ // Copyright (c) 2015 Alexander Schuch. All rights reserved. // -#import +#import //! Project version number for QRCode. FOUNDATION_EXPORT double QRCodeVersionNumber; diff --git a/QRCode/QRCode.swift b/QRCode/QRCode.swift index 826ee94..be67eae 100644 --- a/QRCode/QRCode.swift +++ b/QRCode/QRCode.swift @@ -6,16 +6,22 @@ // Copyright (c) 2015 Alexander Schuch. All rights reserved. // -import UIKit +#if os(iOS) + import UIKit +#endif // iOS + +#if os(OSX) + import Cocoa +#endif // macOS public typealias 🔳 = QRCode /// QRCode generator public struct QRCode { - + /** The level of error correction. - + - Low: 7% - Medium: 15% - Quartile: 25% @@ -27,30 +33,30 @@ public struct QRCode { case Quartile = "Q" case High = "H" } - + /// Data contained in the generated QRCode public let data: Data - + /// Foreground color of the output /// Defaults to black public var color = CIColor(red: 0, green: 0, blue: 0) - + /// Background color of the output /// Defaults to white public var backgroundColor = CIColor(red: 1, green: 1, blue: 1) - + /// Size of the output public var size = CGSize(width: 200, height: 200) - + /// The error correction. The default value is `.Low`. public var errorCorrection = ErrorCorrection.Low - + // MARK: Init - + public init(_ data: Data) { self.data = data } - + public init?(_ string: String) { if let data = string.data(using: .isoLatin1) { self.data = data @@ -58,7 +64,7 @@ public struct QRCode { return nil } } - + public init?(_ url: URL) { if let data = url.absoluteString.data(using: .isoLatin1) { self.data = data @@ -66,38 +72,38 @@ public struct QRCode { return nil } } - + // MARK: Generate QRCode - + /// The QRCode's UIImage representation - public var image: UIImage? { + public var image: Image? { guard let ciImage = ciImage else { return nil } - + // Size let ciImageSize = ciImage.extent.size let widthRatio = size.width / ciImageSize.width let heightRatio = size.height / ciImageSize.height - + return ciImage.nonInterpolatedImage(withScale: Scale(dx: widthRatio, dy: heightRatio)) } - + /// The QRCode's CIImage representation public var ciImage: CIImage? { // Generate QRCode guard let qrFilter = CIFilter(name: "CIQRCodeGenerator") else { return nil } - + qrFilter.setDefaults() qrFilter.setValue(data, forKey: "inputMessage") qrFilter.setValue(self.errorCorrection.rawValue, forKey: "inputCorrectionLevel") - + // Color code and background guard let colorFilter = CIFilter(name: "CIFalseColor") else { return nil } - + colorFilter.setDefaults() colorFilter.setValue(qrFilter.outputImage, forKey: "inputImage") colorFilter.setValue(color, forKey: "inputColor0") colorFilter.setValue(backgroundColor, forKey: "inputColor1") - + return colorFilter.outputImage } } diff --git a/QRCode/UIImageViewExtension.swift b/QRCode/UIImageViewExtension.swift index 789175d..2c4035b 100644 --- a/QRCode/UIImageViewExtension.swift +++ b/QRCode/UIImageViewExtension.swift @@ -9,12 +9,12 @@ import UIKit public extension UIImageView { - + /// Creates a new image view with the given QRCode /// /// - parameter qrCode: The QRCode to display in the image view public convenience init(qrCode: QRCode) { self.init(image: qrCode.image) } - + } diff --git a/QRCodeTests/QRCodeTests.swift b/QRCodeTests/QRCodeTests.swift index d1cf844..5882466 100644 --- a/QRCodeTests/QRCodeTests.swift +++ b/QRCodeTests/QRCodeTests.swift @@ -6,33 +6,40 @@ // Copyright (c) 2015 Alexander Schuch. All rights reserved. // -import UIKit +#if os(iOS) + import UIKit +#endif // iOS + +#if os(OSX) + import Cocoa +#endif // macOS + import XCTest @testable import QRCode class QRCodeTests: XCTestCase { - + func testDefaultValues() { let qrCode = QRCode("hello") - + XCTAssert(qrCode != nil, "QRCode is nil") XCTAssertEqual(CIColor(red: 0, green: 0, blue: 0), qrCode!.color, "Initial color is not black") XCTAssertEqual(CIColor(red: 1, green: 1, blue: 1), qrCode!.backgroundColor, "Initial backgroundColor is not white") XCTAssertEqual(CGSize(width: 200, height: 200), qrCode!.size, "Initial size is not 200x200") } - + func testInitWithData() { let data = "hello".data(using: .isoLatin1)! let qrCode = QRCode(data) - + XCTAssertEqual(data, qrCode.data, "data is not equal") } - + func testInitWithString() { let string = "hello" let data = string.data(using: .isoLatin1)! let qrCode = QRCode(string) - + XCTAssert(qrCode != nil, "QRCode is nil") XCTAssertEqual(data, qrCode!.data, "data is not equal") } @@ -41,53 +48,53 @@ class QRCodeTests: XCTestCase { let url = URL(string: "http://example.com")! let data = url.absoluteString.data(using: .isoLatin1)! let qrCode = QRCode(url) - + XCTAssert(qrCode != nil, "QRCode is nil") XCTAssertEqual(data, qrCode!.data, "data is not equal") } - + func testColor() { let red = CIColor(red: 1, green: 0, blue: 0) let blue = CIColor(red: 0, green: 0, blue: 1) - + var qrCode = QRCode("hello") qrCode?.color = red qrCode?.backgroundColor = blue - + XCTAssert(qrCode != nil, "QRCode is nil") XCTAssertEqual(red, qrCode!.color, "color is not red") XCTAssertEqual(blue, qrCode!.backgroundColor, "backgroundColor is not blue") - + qrCode?.color = blue qrCode?.backgroundColor = red - + XCTAssertEqual(blue, qrCode!.color, "color is not blue") XCTAssertEqual(red, qrCode!.backgroundColor, "backgroundColor is not red") } - + func testSize() { var size = CGSize(width: 400, height: 400) - + var qrCode = QRCode("hello") qrCode?.size = size - + XCTAssert(qrCode != nil, "QRCode is nil") XCTAssertEqual(size, qrCode!.size, "size is not equal") - + size = CGSize(width: 10.457, height: 12.454) qrCode?.size = size - + XCTAssertEqual(size, qrCode!.size, "size is not equal") } - + func testImageSize() { let size = CGSize(width: 100, height: 100) - + var qrCode = QRCode("hello") qrCode?.size = size - + let image = qrCode?.image - + XCTAssert(qrCode != nil, "QRCode is nil") XCTAssert(image != nil, "image is nil") XCTAssertEqual(image!.size, size) diff --git a/README.md b/README.md index 2bb0285..2ed3ebd 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Change the output size of the QRCode output image via the `size` property. ```swift qrCode.size = CGSize(width: 300, height: 300) -qrCode.image // UIImage (300x300) +qrCode.image // UIImage/NSImage (300x300) ``` **Color** @@ -49,12 +49,12 @@ Modify the colors of the QRCode output image via `color` and `backgroundColor` p ```swift qrCode.color = CIColor(rgba: "16a085") qrCode.backgroundColor = CIColor(rgba: "000") -qrCode.image // UIImage (green QRCode color and black background) +qrCode.image // UIImage/NSImage (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. +> **Note**: The above examples make use of the `CIColor` extension that ships with this project to create colors based on HEX strings. -### UIImageView extension +### UIImageView extension (iOS only) For convenience, a `UIImageView` extension is provided to directly initialize an image view with an instance of `QRCode`. @@ -76,9 +76,9 @@ Current Swift compatibility breakdown: | Swift Version | Framework Version | | ------------- | ----------------- | -| 3.0 | 2.x | -| 2.3 | 1.x | -| 2.2 | 0.x | +| 3.0 | 2.x | +| 2.3 | 1.x | +| 2.2 | 0.x | [all releases]: https://github.com/aschuch/QRCode/releases @@ -115,7 +115,7 @@ Open the Xcode project and press `⌘-U` to run the tests. Alternatively, all tests can be run from the terminal using [xctool](https://github.com/facebook/xctool). ```bash -xctool -scheme QRCodeTests -sdk iphonesimulator test +xctool -scheme QRCodeTests_iOS -sdk iphonesimulator test ``` ## Todo