misc
This commit is contained in:
parent
57d88e8cba
commit
7ad3f8821e
12 changed files with 954 additions and 12 deletions
|
@ -16,6 +16,11 @@
|
|||
BDA9339624EFAF1500345985 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BDA9339424EFAF1500345985 /* LaunchScreen.storyboard */; };
|
||||
BDA933A124EFAF1600345985 /* busynessTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDA933A024EFAF1600345985 /* busynessTests.swift */; };
|
||||
BDA933AC24EFAF1600345985 /* busynessUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDA933AB24EFAF1600345985 /* busynessUITests.swift */; };
|
||||
BDA933C024EFB1C900345985 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BDA933BF24EFB1C900345985 /* WidgetKit.framework */; };
|
||||
BDA933C224EFB1C900345985 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BDA933C124EFB1C900345985 /* SwiftUI.framework */; };
|
||||
BDA933C524EFB1C900345985 /* card.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDA933C424EFB1C900345985 /* card.swift */; };
|
||||
BDA933C724EFB1CF00345985 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BDA933C624EFB1CF00345985 /* Assets.xcassets */; };
|
||||
BDA933CB24EFB1CF00345985 /* cardExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = BDA933BD24EFB1C900345985 /* cardExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
|
@ -33,8 +38,39 @@
|
|||
remoteGlobalIDString = BDA9338324EFAF0600345985;
|
||||
remoteInfo = busyness;
|
||||
};
|
||||
BDA933C924EFB1CF00345985 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = BDA9337C24EFAF0600345985 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = BDA933BC24EFB1C900345985;
|
||||
remoteInfo = cardExtension;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
BDA933CF24EFB1CF00345985 /* Embed App Extensions */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 13;
|
||||
files = (
|
||||
BDA933CB24EFB1CF00345985 /* cardExtension.appex in Embed App Extensions */,
|
||||
);
|
||||
name = "Embed App Extensions";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
BDA933FD24F1C3F700345985 /* Embed Watch Content */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "$(CONTENTS_FOLDER_PATH)/Watch";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
);
|
||||
name = "Embed Watch Content";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
BDA9338424EFAF0600345985 /* busyness.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = busyness.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BDA9338724EFAF0600345985 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
|
@ -51,6 +87,14 @@
|
|||
BDA933A724EFAF1600345985 /* busynessUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = busynessUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BDA933AB24EFAF1600345985 /* busynessUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = busynessUITests.swift; sourceTree = "<group>"; };
|
||||
BDA933AD24EFAF1600345985 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
BDA933BD24EFB1C900345985 /* cardExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = cardExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
BDA933BF24EFB1C900345985 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };
|
||||
BDA933C124EFB1C900345985 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; };
|
||||
BDA933C424EFB1C900345985 /* card.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = card.swift; sourceTree = "<group>"; };
|
||||
BDA933C624EFB1CF00345985 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
BDA933C824EFB1CF00345985 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
BDA933D024EFE28900345985 /* cardExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = cardExtension.entitlements; sourceTree = "<group>"; };
|
||||
BDA933D124EFE2AA00345985 /* busyness.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = busyness.entitlements; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
@ -75,15 +119,27 @@
|
|||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
BDA933BA24EFB1C900345985 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BDA933C224EFB1C900345985 /* SwiftUI.framework in Frameworks */,
|
||||
BDA933C024EFB1C900345985 /* WidgetKit.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
BDA9337B24EFAF0600345985 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BDA933D024EFE28900345985 /* cardExtension.entitlements */,
|
||||
BDA9338624EFAF0600345985 /* busyness */,
|
||||
BDA9339F24EFAF1600345985 /* busynessTests */,
|
||||
BDA933AA24EFAF1600345985 /* busynessUITests */,
|
||||
BDA933C324EFB1C900345985 /* card */,
|
||||
BDA933BE24EFB1C900345985 /* Frameworks */,
|
||||
BDA9338524EFAF0600345985 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
|
@ -94,6 +150,7 @@
|
|||
BDA9338424EFAF0600345985 /* busyness.app */,
|
||||
BDA9339C24EFAF1600345985 /* busynessTests.xctest */,
|
||||
BDA933A724EFAF1600345985 /* busynessUITests.xctest */,
|
||||
BDA933BD24EFB1C900345985 /* cardExtension.appex */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
|
@ -101,6 +158,7 @@
|
|||
BDA9338624EFAF0600345985 /* busyness */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BDA933D124EFE2AA00345985 /* busyness.entitlements */,
|
||||
BDA9338724EFAF0600345985 /* AppDelegate.swift */,
|
||||
BDA9338924EFAF0600345985 /* SceneDelegate.swift */,
|
||||
BDA9338B24EFAF0600345985 /* ViewController.swift */,
|
||||
|
@ -131,6 +189,25 @@
|
|||
path = busynessUITests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BDA933BE24EFB1C900345985 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BDA933BF24EFB1C900345985 /* WidgetKit.framework */,
|
||||
BDA933C124EFB1C900345985 /* SwiftUI.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BDA933C324EFB1C900345985 /* card */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BDA933C424EFB1C900345985 /* card.swift */,
|
||||
BDA933C624EFB1CF00345985 /* Assets.xcassets */,
|
||||
BDA933C824EFB1CF00345985 /* Info.plist */,
|
||||
);
|
||||
path = card;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
|
@ -141,10 +218,13 @@
|
|||
BDA9338024EFAF0600345985 /* Sources */,
|
||||
BDA9338124EFAF0600345985 /* Frameworks */,
|
||||
BDA9338224EFAF0600345985 /* Resources */,
|
||||
BDA933CF24EFB1CF00345985 /* Embed App Extensions */,
|
||||
BDA933FD24F1C3F700345985 /* Embed Watch Content */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
BDA933CA24EFB1CF00345985 /* PBXTargetDependency */,
|
||||
);
|
||||
name = busyness;
|
||||
productName = busyness;
|
||||
|
@ -187,6 +267,23 @@
|
|||
productReference = BDA933A724EFAF1600345985 /* busynessUITests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.ui-testing";
|
||||
};
|
||||
BDA933BC24EFB1C900345985 /* cardExtension */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = BDA933CC24EFB1CF00345985 /* Build configuration list for PBXNativeTarget "cardExtension" */;
|
||||
buildPhases = (
|
||||
BDA933B924EFB1C900345985 /* Sources */,
|
||||
BDA933BA24EFB1C900345985 /* Frameworks */,
|
||||
BDA933BB24EFB1C900345985 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = cardExtension;
|
||||
productName = cardExtension;
|
||||
productReference = BDA933BD24EFB1C900345985 /* cardExtension.appex */;
|
||||
productType = "com.apple.product-type.app-extension";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
|
@ -207,6 +304,9 @@
|
|||
CreatedOnToolsVersion = 12.0;
|
||||
TestTargetID = BDA9338324EFAF0600345985;
|
||||
};
|
||||
BDA933BC24EFB1C900345985 = {
|
||||
CreatedOnToolsVersion = 12.0;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = BDA9337F24EFAF0600345985 /* Build configuration list for PBXProject "busyness" */;
|
||||
|
@ -225,6 +325,7 @@
|
|||
BDA9338324EFAF0600345985 /* busyness */,
|
||||
BDA9339B24EFAF1600345985 /* busynessTests */,
|
||||
BDA933A624EFAF1600345985 /* busynessUITests */,
|
||||
BDA933BC24EFB1C900345985 /* cardExtension */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
@ -254,6 +355,14 @@
|
|||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
BDA933BB24EFB1C900345985 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BDA933C724EFB1CF00345985 /* Assets.xcassets in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
|
@ -284,6 +393,14 @@
|
|||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
BDA933B924EFB1C900345985 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BDA933C524EFB1C900345985 /* card.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
|
@ -297,6 +414,11 @@
|
|||
target = BDA9338324EFAF0600345985 /* busyness */;
|
||||
targetProxy = BDA933A824EFAF1600345985 /* PBXContainerItemProxy */;
|
||||
};
|
||||
BDA933CA24EFB1CF00345985 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = BDA933BC24EFB1C900345985 /* cardExtension */;
|
||||
targetProxy = BDA933C924EFB1CF00345985 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
|
@ -438,8 +560,10 @@
|
|||
BDA933B124EFAF1600345985 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_ENTITLEMENTS = busyness/busyness.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = PRBH2T6668;
|
||||
INFOPLIST_FILE = busyness/Info.plist;
|
||||
|
@ -449,6 +573,7 @@
|
|||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = dev.mpg13.busyness;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SUPPORTS_MACCATALYST = NO;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
|
@ -457,8 +582,10 @@
|
|||
BDA933B224EFAF1600345985 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_ENTITLEMENTS = busyness/busyness.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = PRBH2T6668;
|
||||
INFOPLIST_FILE = busyness/Info.plist;
|
||||
|
@ -468,6 +595,7 @@
|
|||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = dev.mpg13.busyness;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SUPPORTS_MACCATALYST = NO;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
|
@ -557,6 +685,52 @@
|
|||
};
|
||||
name = Release;
|
||||
};
|
||||
BDA933CD24EFB1CF00345985 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
|
||||
CODE_SIGN_ENTITLEMENTS = cardExtension.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = PRBH2T6668;
|
||||
INFOPLIST_FILE = card/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = dev.mpg13.busyness.card;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SUPPORTS_MACCATALYST = NO;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2,6";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
BDA933CE24EFB1CF00345985 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
|
||||
CODE_SIGN_ENTITLEMENTS = cardExtension.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
DEVELOPMENT_TEAM = PRBH2T6668;
|
||||
INFOPLIST_FILE = card/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = dev.mpg13.busyness.card;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SUPPORTS_MACCATALYST = NO;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2,6";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
|
@ -596,6 +770,15 @@
|
|||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
BDA933CC24EFB1CF00345985 /* Build configuration list for PBXNativeTarget "cardExtension" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
BDA933CD24EFB1CF00345985 /* Debug */,
|
||||
BDA933CE24EFB1CF00345985 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = BDA9337C24EFAF0600345985 /* Project object */;
|
||||
|
|
|
@ -9,6 +9,26 @@
|
|||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>cardExtension.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>watchcard (Complication).xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>4</integer>
|
||||
</dict>
|
||||
<key>watchcard (Notification).xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>3</integer>
|
||||
</dict>
|
||||
<key>watchcard.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>2</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -1,24 +1,126 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17124"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="busyness" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
<subviews>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Name" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="RJA-BS-QAJ">
|
||||
<rect key="frame" x="20" y="331" width="374" height="34"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<textInputTraits key="textInputTraits" textContentType="name"/>
|
||||
<connections>
|
||||
<action selector="nameTextFieldEntered:" destination="BYZ-38-t0r" eventType="editingDidEnd" id="gd2-BW-NAP"/>
|
||||
</connections>
|
||||
</textField>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Phone/Social Media" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="hwg-L6-547">
|
||||
<rect key="frame" x="20" y="415" width="374" height="34"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
<connections>
|
||||
<action selector="phoneTextFieldEntered:" destination="BYZ-38-t0r" eventType="editingDidEnd" id="jB6-K9-aBH"/>
|
||||
</connections>
|
||||
</textField>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Email" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="rOR-Rs-JYd">
|
||||
<rect key="frame" x="20" y="373" width="374" height="34"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits" keyboardType="emailAddress" textContentType="email"/>
|
||||
<connections>
|
||||
<action selector="emailTextFieldEntered:" destination="BYZ-38-t0r" eventType="editingDidEnd" id="9rp-Ju-8q5"/>
|
||||
</connections>
|
||||
</textField>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="MQL-Um-dLh">
|
||||
<rect key="frame" x="20" y="458" width="115" height="115.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="115" id="EKw-Sr-DBv"/>
|
||||
<constraint firstAttribute="height" constant="115" id="adl-bS-6U3"/>
|
||||
</constraints>
|
||||
<state key="normal" backgroundImage="person.badge.plus" catalog="system"/>
|
||||
<connections>
|
||||
<action selector="cardPhotoPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="PNu-YA-F3x"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="d7K-LV-eTS">
|
||||
<rect key="frame" x="279" y="458" width="115" height="112.5"/>
|
||||
<gestureRecognizers/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="115" id="CAK-lO-Ikw"/>
|
||||
<constraint firstAttribute="height" constant="115" id="jgd-LV-tyC"/>
|
||||
</constraints>
|
||||
<state key="normal" backgroundImage="qrcode" catalog="system"/>
|
||||
<connections>
|
||||
<action selector="qrCodeButtonPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="A88-op-k8R"/>
|
||||
<outletCollection property="gestureRecognizers" destination="C0z-9a-k1S" appends="YES" id="shU-g5-Uf8"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="AHD-6A-mNB">
|
||||
<rect key="frame" x="20" y="810" width="50" height="52.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="50" id="QOu-Ow-JB4"/>
|
||||
<constraint firstAttribute="height" constant="50" id="qJv-6m-DaX"/>
|
||||
</constraints>
|
||||
<state key="normal" backgroundImage="paintbrush" catalog="system"/>
|
||||
<connections>
|
||||
<action selector="colorPickerButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="G0N-U3-FpY"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
<constraints>
|
||||
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="rOR-Rs-JYd" secondAttribute="trailing" constant="20" id="6lC-h8-H70"/>
|
||||
<constraint firstItem="rOR-Rs-JYd" firstAttribute="top" secondItem="RJA-BS-QAJ" secondAttribute="bottom" constant="8" symbolic="YES" id="8gQ-Yb-95B"/>
|
||||
<constraint firstItem="RJA-BS-QAJ" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="287" id="9yC-46-MCp"/>
|
||||
<constraint firstItem="MQL-Um-dLh" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="20" id="GMf-FU-QvO"/>
|
||||
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="hwg-L6-547" secondAttribute="trailing" constant="20" id="H83-e4-TMe"/>
|
||||
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="RJA-BS-QAJ" secondAttribute="trailing" constant="20" id="Lt4-Wi-s3d"/>
|
||||
<constraint firstItem="rOR-Rs-JYd" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="20" id="P0s-y0-E4j"/>
|
||||
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="d7K-LV-eTS" secondAttribute="trailing" constant="20" id="P4d-Oy-3Kg"/>
|
||||
<constraint firstItem="MQL-Um-dLh" firstAttribute="top" secondItem="hwg-L6-547" secondAttribute="bottom" constant="8" symbolic="YES" id="RCk-ME-pcl"/>
|
||||
<constraint firstItem="d7K-LV-eTS" firstAttribute="top" secondItem="hwg-L6-547" secondAttribute="bottom" constant="8" symbolic="YES" id="bB0-Qv-qTZ"/>
|
||||
<constraint firstItem="hwg-L6-547" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="20" id="fet-i5-3Fe"/>
|
||||
<constraint firstItem="RJA-BS-QAJ" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="20" id="gc2-uQ-mLQ"/>
|
||||
<constraint firstItem="AHD-6A-mNB" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="20" id="nyB-dc-oh0"/>
|
||||
<constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="AHD-6A-mNB" secondAttribute="bottom" constant="1" id="r0M-TJ-gey"/>
|
||||
<constraint firstItem="hwg-L6-547" firstAttribute="top" secondItem="rOR-Rs-JYd" secondAttribute="bottom" constant="8" symbolic="YES" id="r7x-18-h0G"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="cardPhoto" destination="MQL-Um-dLh" id="o5t-uP-09u"/>
|
||||
<outlet property="emailTextField" destination="rOR-Rs-JYd" id="rO6-JE-aOK"/>
|
||||
<outlet property="fullView" destination="8bC-Xf-vdC" id="7dm-gP-asr"/>
|
||||
<outlet property="nameTextField" destination="RJA-BS-QAJ" id="eqU-E5-Dwt"/>
|
||||
<outlet property="phoneTextField" destination="hwg-L6-547" id="WNA-FV-s9U"/>
|
||||
<outlet property="qrCodeImage" destination="d7K-LV-eTS" id="16H-HD-P8l"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
<pongPressGestureRecognizer allowableMovement="10" minimumPressDuration="0.5" id="C0z-9a-k1S">
|
||||
<connections>
|
||||
<action selector="qrButtonLongPressed:" destination="BYZ-38-t0r" id="nJF-XJ-dwS"/>
|
||||
</connections>
|
||||
</pongPressGestureRecognizer>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="79.710144927536234" y="42.857142857142854"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="paintbrush" catalog="system" width="122" height="128"/>
|
||||
<image name="person.badge.plus" catalog="system" width="128" height="124"/>
|
||||
<image name="qrcode" catalog="system" width="128" height="114"/>
|
||||
<systemColor name="systemBackgroundColor">
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
|
@ -7,13 +7,237 @@
|
|||
|
||||
import UIKit
|
||||
|
||||
class ViewController: UIViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
// Do any additional setup after loading the view.
|
||||
extension UserDefaults {
|
||||
func colorForKey(key: String) -> UIColor? {
|
||||
var colorReturnded: UIColor?
|
||||
if let colorData = data(forKey: key) {
|
||||
do {
|
||||
if let color = try NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(colorData) as? UIColor {
|
||||
colorReturnded = color
|
||||
}
|
||||
} catch {
|
||||
print("Error UserDefaults")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return colorReturnded
|
||||
}
|
||||
|
||||
func setColor(color: UIColor?, forKey key: String) {
|
||||
var colorData: NSData?
|
||||
if let color = color {
|
||||
do {
|
||||
let data = try NSKeyedArchiver.archivedData(withRootObject: color, requiringSecureCoding: false) as NSData?
|
||||
colorData = data
|
||||
} catch {
|
||||
print("Error UserDefaults")
|
||||
}
|
||||
}
|
||||
set(colorData, forKey: key)
|
||||
}
|
||||
}
|
||||
|
||||
extension CIImage {
|
||||
/// Inverts the colors and creates a transparent image by converting the mask to alpha.
|
||||
/// Input image should be black and white.
|
||||
var transparent: CIImage? {
|
||||
return inverted?.blackTransparent
|
||||
}
|
||||
|
||||
/// Inverts the colors.
|
||||
var inverted: CIImage? {
|
||||
guard let invertedColorFilter = CIFilter(name: "CIColorInvert") else { return nil }
|
||||
|
||||
invertedColorFilter.setValue(self, forKey: "inputImage")
|
||||
return invertedColorFilter.outputImage
|
||||
}
|
||||
|
||||
/// Converts all black to transparent.
|
||||
var blackTransparent: CIImage? {
|
||||
guard let blackTransparentFilter = CIFilter(name: "CIMaskToAlpha") else { return nil }
|
||||
blackTransparentFilter.setValue(self, forKey: "inputImage")
|
||||
return blackTransparentFilter.outputImage
|
||||
}
|
||||
|
||||
/// Applies the given color as a tint color.
|
||||
func tinted(using color: UIColor) -> CIImage?
|
||||
{
|
||||
guard
|
||||
let transparentQRImage = transparent,
|
||||
let filter = CIFilter(name: "CIMultiplyCompositing"),
|
||||
let colorFilter = CIFilter(name: "CIConstantColorGenerator") else { return nil }
|
||||
|
||||
let ciColor = CIColor(color: color)
|
||||
colorFilter.setValue(ciColor, forKey: kCIInputColorKey)
|
||||
let colorImage = colorFilter.outputImage
|
||||
|
||||
filter.setValue(colorImage, forKey: kCIInputImageKey)
|
||||
filter.setValue(transparentQRImage, forKey: kCIInputBackgroundImageKey)
|
||||
|
||||
return filter.outputImage!
|
||||
}
|
||||
}
|
||||
|
||||
extension URL {
|
||||
|
||||
/// Creates a QR code for the current URL in the given color.
|
||||
func qrImage(using color: UIColor) -> CIImage? {
|
||||
return qrImage?.tinted(using: color)
|
||||
}
|
||||
|
||||
/// Returns a black and white QR code for this URL.
|
||||
var qrImage: CIImage? {
|
||||
guard let qrFilter = CIFilter(name: "CIQRCodeGenerator") else { return nil }
|
||||
let qrData = absoluteString.data(using: String.Encoding.ascii)
|
||||
qrFilter.setValue(qrData, forKey: "inputMessage")
|
||||
|
||||
let qrTransform = CGAffineTransform(scaleX: 12, y: 12)
|
||||
return qrFilter.outputImage?.transformed(by: qrTransform)
|
||||
}
|
||||
}
|
||||
|
||||
class ViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UIColorPickerViewControllerDelegate {
|
||||
|
||||
//let prefs = UserDefaults(suiteName:"group.dev.mpg13.busyness")
|
||||
let defaults = UserDefaults(suiteName:"group.dev.mpg13.busyness")
|
||||
|
||||
@IBOutlet var fullView: UIView!
|
||||
|
||||
|
||||
@IBOutlet var cardPhoto: UIButton!
|
||||
|
||||
@IBOutlet var qrCodeImage: UIButton!
|
||||
|
||||
@IBOutlet var nameTextField: UITextField!
|
||||
|
||||
@IBOutlet var phoneTextField: UITextField!
|
||||
|
||||
@IBOutlet var emailTextField: UITextField!
|
||||
|
||||
let imagePicker = UIImagePickerController()
|
||||
let colorPicker = UIColorPickerViewController()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
imagePicker.delegate = self
|
||||
colorPicker.delegate = self
|
||||
|
||||
if(defaults?.colorForKey(key: "savedColor") != nil){
|
||||
fullView.backgroundColor = defaults?.colorForKey(key: "savedColor")
|
||||
}
|
||||
|
||||
let qrURL = defaults?.string(forKey: "savedQRURL")
|
||||
if ((qrURL == nil) || (qrURL == "")) {
|
||||
let defaultQR = UIImage(systemName: "qrcode")
|
||||
qrCodeImage.setBackgroundImage(defaultQR, for: qrCodeImage.state)
|
||||
} else {
|
||||
let qrCode = URL(string: qrURL!)?.qrImage(using: UIColor.black)
|
||||
qrCodeImage.setBackgroundImage(UIImage(ciImage: qrCode!), for: qrCodeImage.state)
|
||||
}
|
||||
|
||||
nameTextField.text = defaults?.string(forKey: "savedCardName")
|
||||
phoneTextField.text = defaults?.string(forKey: "savedCardPhone")
|
||||
emailTextField.text = defaults?.string(forKey: "savedCardEmail")
|
||||
if let cardImageData = defaults?.data(forKey: "savedCardPhoto"){
|
||||
cardPhoto.setBackgroundImage(UIImage(data: cardImageData), for: cardPhoto.state)}
|
||||
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
|
||||
@IBAction func nameTextFieldEntered(_ sender: Any) {
|
||||
defaults?.setValue(nameTextField.text, forKey: "savedCardName")
|
||||
}
|
||||
|
||||
@IBAction func phoneTextFieldEntered(_ sender: Any) {
|
||||
defaults?.setValue(phoneTextField.text, forKey: "savedCardPhone")
|
||||
}
|
||||
|
||||
@IBAction func emailTextFieldEntered(_ sender: Any) {
|
||||
defaults?.setValue(emailTextField.text, forKey: "savedCardEmail")
|
||||
}
|
||||
|
||||
@IBAction func cardPhotoPressed(_ sender: Any) {
|
||||
imagePicker.allowsEditing = true
|
||||
imagePicker.sourceType = .photoLibrary
|
||||
|
||||
present(imagePicker, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
@IBAction func qrCodeButtonPressed(_ sender: Any) {
|
||||
|
||||
|
||||
|
||||
var alertController:UIAlertController?
|
||||
alertController = UIAlertController(title: "Enter a URL Below",
|
||||
message: "Text entered below will be turned into a QR code, which can be used as a quick link from your card.",
|
||||
preferredStyle: .alert)
|
||||
|
||||
alertController!.addTextField(
|
||||
configurationHandler: {(textField: UITextField!) in
|
||||
textField.placeholder = "https://micahpgomez.dev"
|
||||
})
|
||||
|
||||
let action = UIAlertAction(title: "Submit",
|
||||
style: UIAlertAction.Style.default,
|
||||
handler: {[weak self]
|
||||
(paramAction:UIAlertAction!) in
|
||||
if let textFields = alertController?.textFields{
|
||||
let theTextFields = textFields as [UITextField]
|
||||
let enteredText = theTextFields[0].text
|
||||
self?.defaults?.setValue(enteredText, forKey: "savedQRURL")
|
||||
|
||||
if (enteredText == "") {
|
||||
let defaultQR = UIImage(systemName: "qrcode")
|
||||
self!.qrCodeImage.setBackgroundImage(defaultQR, for: self!.qrCodeImage.state)
|
||||
} else {
|
||||
let qrCode = URL(string: enteredText!)?.qrImage(using: UIColor.black)
|
||||
self!.qrCodeImage.setBackgroundImage(UIImage(ciImage: qrCode!), for: self!.qrCodeImage.state)
|
||||
self!.defaults?.setValue(UIImage(ciImage: qrCode!).pngData(), forKey: "savedQRPhoto")
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
alertController?.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
|
||||
alertController?.addAction(action)
|
||||
self.present(alertController!,
|
||||
animated: true,
|
||||
completion: nil)
|
||||
}
|
||||
|
||||
@IBAction func qrButtonLongPressed(_ sender: Any) {
|
||||
guard let url = URL(string: defaults?.string(forKey: "savedQRURL")! ?? "") else { return }
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
|
||||
@IBAction func colorPickerButton(_ sender: Any) {
|
||||
present(colorPicker, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
|
||||
if let pickedImage = info[UIImagePickerController.InfoKey.editedImage] as? UIImage {
|
||||
cardPhoto.setBackgroundImage(pickedImage, for: cardPhoto.state)
|
||||
defaults?.setValue(pickedImage.pngData(), forKey: "savedCardPhoto")
|
||||
}
|
||||
|
||||
dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
|
||||
dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
func colorPickerViewControllerDidFinish(_ viewController: UIColorPickerViewController) {
|
||||
dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
func colorPickerViewControllerDidSelectColor(_ viewController: UIColorPickerViewController) {
|
||||
let color = viewController.selectedColor
|
||||
|
||||
fullView.backgroundColor = color
|
||||
defaults?.setColor(color: color, forKey: "savedColor")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
14
busyness/busyness.entitlements
Normal file
14
busyness/busyness.entitlements
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.application-groups</key>
|
||||
<array>
|
||||
<string>group.dev.mpg13.busyness</string>
|
||||
</array>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
11
card/Assets.xcassets/AccentColor.colorset/Contents.json
Normal file
11
card/Assets.xcassets/AccentColor.colorset/Contents.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
98
card/Assets.xcassets/AppIcon.appiconset/Contents.json
Normal file
98
card/Assets.xcassets/AppIcon.appiconset/Contents.json
Normal file
|
@ -0,0 +1,98 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "60x60"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "60x60"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "76x76"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "76x76"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "83.5x83.5"
|
||||
},
|
||||
{
|
||||
"idiom" : "ios-marketing",
|
||||
"scale" : "1x",
|
||||
"size" : "1024x1024"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
6
card/Assets.xcassets/Contents.json
Normal file
6
card/Assets.xcassets/Contents.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
11
card/Assets.xcassets/WidgetBackground.colorset/Contents.json
Normal file
11
card/Assets.xcassets/WidgetBackground.colorset/Contents.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
29
card/Info.plist
Normal file
29
card/Info.plist
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>card</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>NSExtension</key>
|
||||
<dict>
|
||||
<key>NSExtensionPointIdentifier</key>
|
||||
<string>com.apple.widgetkit-extension</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
230
card/card.swift
Normal file
230
card/card.swift
Normal file
|
@ -0,0 +1,230 @@
|
|||
//
|
||||
// card.swift
|
||||
// card
|
||||
//
|
||||
// Created by Micah Gomez on 8/21/20.
|
||||
//
|
||||
|
||||
import WidgetKit
|
||||
import SwiftUI
|
||||
|
||||
extension UserDefaults {
|
||||
func colorForKey(key: String) -> UIColor? {
|
||||
var colorReturnded: UIColor?
|
||||
if let colorData = data(forKey: key) {
|
||||
do {
|
||||
if let color = try NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(colorData) as? UIColor {
|
||||
colorReturnded = color
|
||||
}
|
||||
} catch {
|
||||
print("Error UserDefaults")
|
||||
}
|
||||
}
|
||||
return colorReturnded
|
||||
}
|
||||
|
||||
func setColor(color: UIColor?, forKey key: String) {
|
||||
var colorData: NSData?
|
||||
if let color = color {
|
||||
do {
|
||||
let data = try NSKeyedArchiver.archivedData(withRootObject: color, requiringSecureCoding: false) as NSData?
|
||||
colorData = data
|
||||
} catch {
|
||||
print("Error UserDefaults")
|
||||
}
|
||||
}
|
||||
set(colorData, forKey: key)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct Provider: TimelineProvider {
|
||||
func placeholder(in context: Context) -> SimpleEntry {
|
||||
SimpleEntry(date: Date(), cardName: "Johnny Appleseed", cardPhone: "(123)456-7890", cardEmail: "johnny@appleseed.com", cardPhoto: UIImage(systemName: "person.badge.plus")!, cardQR: UIImage(systemName: "qrcode")!)
|
||||
}
|
||||
|
||||
func getSnapshot(in context: Context, completion: @escaping (SimpleEntry) -> ()) {
|
||||
let entry = SimpleEntry(date: Date(), cardName: "Johnny Appleseed", cardPhone: "(123)456-7890", cardEmail: "johnny@appleseed.com", cardPhoto: UIImage(systemName: "person.badge.plus")!, cardQR: UIImage(systemName: "qrcode")!)
|
||||
completion(entry)
|
||||
}
|
||||
|
||||
func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
|
||||
|
||||
let defaults = UserDefaults(suiteName:"group.dev.mpg13.busyness")
|
||||
var cardName: String
|
||||
if defaults?.string(forKey: "savedCardName") != nil {
|
||||
cardName = (defaults?.string(forKey: "savedCardName"))!
|
||||
} else {
|
||||
cardName = "Johnny Appleseed"
|
||||
}
|
||||
let cardPhone = defaults?.string(forKey: "savedCardPhone") ?? "Phone/Other"
|
||||
let cardEmail = defaults?.string(forKey: "savedCardEmail") ?? "Email"
|
||||
var cardPhoto: UIImage
|
||||
if defaults?.data(forKey: "savedCardPhoto") != nil {
|
||||
cardPhoto = UIImage(data: (defaults?.data(forKey: "savedCardPhoto"))!)!
|
||||
} else {
|
||||
cardPhoto = UIImage(systemName: "person.badge.plus")!
|
||||
}
|
||||
var cardQR: UIImage
|
||||
if defaults?.data(forKey: "savedQRPhoto") != nil {
|
||||
cardQR = UIImage(data: (defaults?.data(forKey: "savedQRPhoto"))!)!
|
||||
} else {
|
||||
cardQR = UIImage(systemName: "qrcode")!
|
||||
}
|
||||
|
||||
let date = Date()
|
||||
let entry = SimpleEntry(
|
||||
date: date,
|
||||
cardName: cardName,
|
||||
cardPhone: cardPhone,
|
||||
cardEmail: cardEmail,
|
||||
cardPhoto: cardPhoto,
|
||||
cardQR: cardQR
|
||||
)
|
||||
let nextUpdateDate = Calendar.current.date(byAdding: .minute, value: 15, to: date)!
|
||||
let timeline = Timeline(
|
||||
entries:[entry],
|
||||
policy: .after(nextUpdateDate)
|
||||
)
|
||||
|
||||
|
||||
/*
|
||||
let currentDate = Date()
|
||||
for minuteOffset in 0 ..< 5 {
|
||||
let entryDate = Calendar.current.date(byAdding: .minute, value: minuteOffset, to: currentDate)!
|
||||
print(entryDate)
|
||||
let entry = SimpleEntry(date: entryDate)
|
||||
entries.append(entry)
|
||||
}
|
||||
|
||||
let timeline = Timeline(entries: entries, policy: .atEnd)*/
|
||||
|
||||
completion(timeline)
|
||||
}
|
||||
}
|
||||
|
||||
struct SimpleEntry: TimelineEntry {
|
||||
let date: Date
|
||||
let cardName: String
|
||||
let cardPhone: String
|
||||
let cardEmail: String
|
||||
let cardPhoto: UIImage
|
||||
let cardQR: UIImage
|
||||
}
|
||||
|
||||
struct cardSmallView : View {
|
||||
var entry: Provider.Entry
|
||||
|
||||
var body: some View{
|
||||
VStack{
|
||||
Spacer()
|
||||
Text(entry.cardName).fontWeight(.heavy).lineLimit(2).minimumScaleFactor(0.5)
|
||||
HStack{
|
||||
Image(uiImage: entry.cardPhoto).resizable().scaledToFit().cornerRadius(16)
|
||||
Image(uiImage: entry.cardQR).resizable().scaledToFit()
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct cardMediumView : View {
|
||||
var entry: Provider.Entry
|
||||
|
||||
var body: some View{
|
||||
GeometryReader{g in
|
||||
VStack(spacing: 5){
|
||||
Spacer()
|
||||
Text(entry.cardName).fontWeight(.heavy).lineLimit(1).font(.system(size: 24)).minimumScaleFactor(0.5).multilineTextAlignment(.center).padding(.top)
|
||||
HStack{
|
||||
Image(uiImage: entry.cardPhoto).resizable()
|
||||
.frame(width: g.size.width / 5, height: g.size.width / 5, alignment: .bottomLeading).cornerRadius(16)
|
||||
Image(uiImage: entry.cardQR).resizable()
|
||||
.frame(width: g.size.width / 5, height: g.size.width / 5, alignment: .bottomLeading)
|
||||
VStack{
|
||||
Spacer()
|
||||
Text(entry.cardPhone).lineLimit(1).font(.system(size: 18, design: .rounded)).minimumScaleFactor(0.3)
|
||||
Text(entry.cardEmail).lineLimit(1).font(.system(size: 18, design: .rounded)).minimumScaleFactor(0.6)
|
||||
Spacer()
|
||||
}.padding(.bottom)
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct cardLargeView : View {
|
||||
var entry: Provider.Entry
|
||||
|
||||
var body: some View{
|
||||
VStack{
|
||||
Spacer()
|
||||
Text(entry.cardName).fontWeight(.heavy).lineLimit(2).font(.system(size: 36)).minimumScaleFactor(0.5)
|
||||
Spacer()
|
||||
HStack{
|
||||
Image(uiImage: entry.cardPhoto).resizable().scaledToFit().cornerRadius(16)
|
||||
Image(uiImage: entry.cardQR).resizable().scaledToFit()
|
||||
}
|
||||
Spacer()
|
||||
Text(entry.cardPhone).lineLimit(1).font(.system(size: 20, design: .rounded)).minimumScaleFactor(0.5)
|
||||
Spacer()
|
||||
Text(entry.cardEmail).lineLimit(1).font(.system(size: 20, design: .rounded)).minimumScaleFactor(0.5)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct detailsNotAvailable : View {
|
||||
var entry: Provider.Entry
|
||||
|
||||
var body: some View{
|
||||
VStack{
|
||||
Text("Nothing Available")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct cardEntryView : View {
|
||||
var entry: Provider.Entry
|
||||
@Environment(\.widgetFamily) var family: WidgetFamily
|
||||
|
||||
let defaults = UserDefaults(suiteName:"group.dev.mpg13.busyness")
|
||||
let viewColor = UserDefaults(suiteName:"group.dev.mpg13.busyness")?.colorForKey(key: "savedColor")
|
||||
|
||||
var body: some View {
|
||||
ZStack
|
||||
{
|
||||
Color(viewColor ?? UIColor.white)
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
Group{
|
||||
switch family {
|
||||
case .systemSmall: cardSmallView(entry: entry)
|
||||
case .systemMedium: cardMediumView(entry: entry)
|
||||
case .systemLarge: cardLargeView(entry: entry)
|
||||
default: detailsNotAvailable(entry: entry)
|
||||
}
|
||||
}.padding(.horizontal)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@main
|
||||
struct card: Widget {
|
||||
let kind: String = "card"
|
||||
|
||||
var body: some WidgetConfiguration {
|
||||
StaticConfiguration(kind: kind, provider: Provider()) { entry in
|
||||
cardEntryView(entry: entry)
|
||||
}
|
||||
.configurationDisplayName("My Widget")
|
||||
.description("This is an example widget.")
|
||||
}
|
||||
}
|
||||
|
||||
struct card_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
cardEntryView(entry: SimpleEntry(date: Date(), cardName: "Johnny Appleseed", cardPhone: "(123)456-7890", cardEmail: "johnny@appleseed.com", cardPhoto: UIImage(systemName: "person.badge.plus")!, cardQR: UIImage(systemName: "qrcode")!))
|
||||
.previewContext(WidgetPreviewContext(family: .systemSmall))
|
||||
}
|
||||
}
|
14
cardExtension.entitlements
Normal file
14
cardExtension.entitlements
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
<key>com.apple.security.application-groups</key>
|
||||
<array>
|
||||
<string>group.dev.mpg13.busyness</string>
|
||||
</array>
|
||||
<key>com.apple.security.network.client</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
Reference in a new issue