Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
304 changes: 303 additions & 1 deletion Example.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

80 changes: 80 additions & 0 deletions Example.xcodeproj/xcshareddata/xcschemes/QRCodeMac.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4DC5CE801DA4FFF3003F9573"
BuildableName = "QRCodeMac.framework"
BlueprintName = "QRCodeMac"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4DC5CE801DA4FFF3003F9573"
BuildableName = "QRCodeMac.framework"
BlueprintName = "QRCodeMac"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "4DC5CE801DA4FFF3003F9573"
BuildableName = "QRCodeMac.framework"
BlueprintName = "QRCodeMac"
ReferencedContainer = "container:Example.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
22 changes: 9 additions & 13 deletions Example/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6724" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6711"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand All @@ -13,14 +15,13 @@
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="667" height="375"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jd7-dt-8LC">
<rect key="frame" x="132.5" y="188.5" width="335" height="222"/>
<view contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jd7-dt-8LC">
<frame key="frameInset" minX="132.5" minY="188.5" width="335" height="222"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ldq-nY-0QF">
<rect key="frame" x="0.0" y="0.0" width="222" height="222"/>
<constraints>
<constraint firstAttribute="width" constant="200" id="9jy-Mn-nqj"/>
<constraint firstAttribute="height" constant="200" id="UnJ-fd-fo5"/>
Expand All @@ -35,42 +36,37 @@
</variation>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="x8h-b6-iSb">
<rect key="frame" x="227" y="58" width="50" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="VSN-bQ-vav"/>
<constraint firstAttribute="width" constant="50" id="woq-CJ-Nmx"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="mcD-Bd-c7A">
<rect key="frame" x="285" y="58" width="50" height="50"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="P7V-Jh-Feh"/>
<constraint firstAttribute="height" constant="50" id="or7-Dy-5CU"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="q6v-7g-Eef">
<rect key="frame" x="227" y="0.0" width="50" height="50"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="Ycs-Ue-ddL"/>
<constraint firstAttribute="height" constant="50" id="hb4-G8-UGn"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="J50-ki-XSt">
<rect key="frame" x="285" y="0.0" width="50" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="dXR-Kb-VTV"/>
<constraint firstAttribute="width" constant="50" id="pQf-wu-uIX"/>
</constraints>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="MJh-3G-Vw5">
<rect key="frame" x="227" y="114" width="108" height="108"/>
<constraints>
<constraint firstAttribute="height" constant="108" id="P4o-cj-upB"/>
<constraint firstAttribute="width" constant="108" id="XIk-sd-PFy"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="J50-ki-XSt" firstAttribute="top" secondItem="jd7-dt-8LC" secondAttribute="top" id="5m3-vz-bN6"/>
<constraint firstItem="MJh-3G-Vw5" firstAttribute="top" secondItem="x8h-b6-iSb" secondAttribute="bottom" constant="6" id="9TR-oX-Azl"/>
Expand All @@ -92,7 +88,7 @@
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.94117647058823528" green="0.94117647058823528" blue="0.94117647058823528" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" red="0.94117647058823528" green="0.94117647058823528" blue="0.94117647058823528" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="centerX" secondItem="jd7-dt-8LC" secondAttribute="centerX" id="7jy-z8-Tvk"/>
<constraint firstAttribute="centerY" secondItem="jd7-dt-8LC" secondAttribute="centerY" id="mhm-cD-MLB"/>
Expand Down
93 changes: 93 additions & 0 deletions ExampleMac/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
//
// AppDelegate.swift
// ExampleMac
//
// Created by Benedikt Terhechte on 05/10/16.
// Copyright © 2016 Alexander Schuch. All rights reserved.
//

import Cocoa
import QRCodeMac

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {

@IBOutlet weak var window: NSWindow!

@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!


func applicationDidFinishLaunching(_ aNotification: Notification) {
// 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
}()

}


func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}


}

58 changes: 58 additions & 0 deletions ExampleMac/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
Loading