Skip to content

Commit

Permalink
SwiftUI Alternate Icons
Browse files Browse the repository at this point in the history
anupamchugh authored Jan 30, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 0f9c9ae commit eca1f95
Showing 18 changed files with 863 additions and 0 deletions.
373 changes: 373 additions & 0 deletions SwiftUIAlternateIcons/SwiftUIAlternateIcons.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,373 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {

/* Begin PBXBuildFile section */
1ECE112F23E20B2C009CDE34 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ECE112E23E20B2C009CDE34 /* AppDelegate.swift */; };
1ECE113123E20B2C009CDE34 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ECE113023E20B2C009CDE34 /* SceneDelegate.swift */; };
1ECE113323E20B2C009CDE34 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ECE113223E20B2C009CDE34 /* ContentView.swift */; };
1ECE113523E20B2F009CDE34 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1ECE113423E20B2F009CDE34 /* Assets.xcassets */; };
1ECE113823E20B2F009CDE34 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1ECE113723E20B2F009CDE34 /* Preview Assets.xcassets */; };
1ECE113B23E20B2F009CDE34 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1ECE113923E20B2F009CDE34 /* LaunchScreen.storyboard */; };
1ECE114423E2171E009CDE34 /* Shades.png in Resources */ = {isa = PBXBuildFile; fileRef = 1ECE114323E2171E009CDE34 /* Shades.png */; };
1ECE114623E34F05009CDE34 /* Sad.png in Resources */ = {isa = PBXBuildFile; fileRef = 1ECE114523E34F05009CDE34 /* Sad.png */; };
1ECE114923E35381009CDE34 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 1ECE114723E35381009CDE34 /* [email protected] */; };
1ECE114A23E35381009CDE34 /* Taxi.png in Resources */ = {isa = PBXBuildFile; fileRef = 1ECE114823E35381009CDE34 /* Taxi.png */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
1ECE112B23E20B2C009CDE34 /* SwiftUIAlternateIcons.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftUIAlternateIcons.app; sourceTree = BUILT_PRODUCTS_DIR; };
1ECE112E23E20B2C009CDE34 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
1ECE113023E20B2C009CDE34 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
1ECE113223E20B2C009CDE34 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
1ECE113423E20B2F009CDE34 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
1ECE113723E20B2F009CDE34 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
1ECE113A23E20B2F009CDE34 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
1ECE113C23E20B2F009CDE34 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
1ECE114323E2171E009CDE34 /* Shades.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Shades.png; sourceTree = "<group>"; };
1ECE114523E34F05009CDE34 /* Sad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Sad.png; sourceTree = "<group>"; };
1ECE114723E35381009CDE34 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
1ECE114823E35381009CDE34 /* Taxi.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Taxi.png; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
1ECE112823E20B2C009CDE34 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
1ECE112223E20B2C009CDE34 = {
isa = PBXGroup;
children = (
1ECE112D23E20B2C009CDE34 /* SwiftUIAlternateIcons */,
1ECE112C23E20B2C009CDE34 /* Products */,
);
sourceTree = "<group>";
};
1ECE112C23E20B2C009CDE34 /* Products */ = {
isa = PBXGroup;
children = (
1ECE112B23E20B2C009CDE34 /* SwiftUIAlternateIcons.app */,
);
name = Products;
sourceTree = "<group>";
};
1ECE112D23E20B2C009CDE34 /* SwiftUIAlternateIcons */ = {
isa = PBXGroup;
children = (
1ECE114223E2170E009CDE34 /* Icons */,
1ECE112E23E20B2C009CDE34 /* AppDelegate.swift */,
1ECE113023E20B2C009CDE34 /* SceneDelegate.swift */,
1ECE113223E20B2C009CDE34 /* ContentView.swift */,
1ECE113423E20B2F009CDE34 /* Assets.xcassets */,
1ECE113923E20B2F009CDE34 /* LaunchScreen.storyboard */,
1ECE113C23E20B2F009CDE34 /* Info.plist */,
1ECE113623E20B2F009CDE34 /* Preview Content */,
);
path = SwiftUIAlternateIcons;
sourceTree = "<group>";
};
1ECE113623E20B2F009CDE34 /* Preview Content */ = {
isa = PBXGroup;
children = (
1ECE113723E20B2F009CDE34 /* Preview Assets.xcassets */,
);
path = "Preview Content";
sourceTree = "<group>";
};
1ECE114223E2170E009CDE34 /* Icons */ = {
isa = PBXGroup;
children = (
1ECE114523E34F05009CDE34 /* Sad.png */,
1ECE114323E2171E009CDE34 /* Shades.png */,
1ECE114823E35381009CDE34 /* Taxi.png */,
1ECE114723E35381009CDE34 /* [email protected] */,
);
path = Icons;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
1ECE112A23E20B2C009CDE34 /* SwiftUIAlternateIcons */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1ECE113F23E20B2F009CDE34 /* Build configuration list for PBXNativeTarget "SwiftUIAlternateIcons" */;
buildPhases = (
1ECE112723E20B2C009CDE34 /* Sources */,
1ECE112823E20B2C009CDE34 /* Frameworks */,
1ECE112923E20B2C009CDE34 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = SwiftUIAlternateIcons;
productName = SwiftUIAlternateIcons;
productReference = 1ECE112B23E20B2C009CDE34 /* SwiftUIAlternateIcons.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
1ECE112323E20B2C009CDE34 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1130;
LastUpgradeCheck = 1130;
ORGANIZATIONNAME = iowncode;
TargetAttributes = {
1ECE112A23E20B2C009CDE34 = {
CreatedOnToolsVersion = 11.3;
};
};
};
buildConfigurationList = 1ECE112623E20B2C009CDE34 /* Build configuration list for PBXProject "SwiftUIAlternateIcons" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 1ECE112223E20B2C009CDE34;
productRefGroup = 1ECE112C23E20B2C009CDE34 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
1ECE112A23E20B2C009CDE34 /* SwiftUIAlternateIcons */,
);
};
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
1ECE112923E20B2C009CDE34 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1ECE114623E34F05009CDE34 /* Sad.png in Resources */,
1ECE113B23E20B2F009CDE34 /* LaunchScreen.storyboard in Resources */,
1ECE114423E2171E009CDE34 /* Shades.png in Resources */,
1ECE113823E20B2F009CDE34 /* Preview Assets.xcassets in Resources */,
1ECE114923E35381009CDE34 /* [email protected] in Resources */,
1ECE114A23E35381009CDE34 /* Taxi.png in Resources */,
1ECE113523E20B2F009CDE34 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
1ECE112723E20B2C009CDE34 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1ECE112F23E20B2C009CDE34 /* AppDelegate.swift in Sources */,
1ECE113123E20B2C009CDE34 /* SceneDelegate.swift in Sources */,
1ECE113323E20B2C009CDE34 /* ContentView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
1ECE113923E20B2F009CDE34 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
1ECE113A23E20B2F009CDE34 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
1ECE113D23E20B2F009CDE34 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
1ECE113E23E20B2F009CDE34 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
1ECE114023E20B2F009CDE34 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"SwiftUIAlternateIcons/Preview Content\"";
DEVELOPMENT_TEAM = M6P56H6G97;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = SwiftUIAlternateIcons/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.iowncode.SwiftUIAlternateIcons;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
1ECE114123E20B2F009CDE34 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"SwiftUIAlternateIcons/Preview Content\"";
DEVELOPMENT_TEAM = M6P56H6G97;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = SwiftUIAlternateIcons/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.iowncode.SwiftUIAlternateIcons;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
1ECE112623E20B2C009CDE34 /* Build configuration list for PBXProject "SwiftUIAlternateIcons" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1ECE113D23E20B2F009CDE34 /* Debug */,
1ECE113E23E20B2F009CDE34 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1ECE113F23E20B2F009CDE34 /* Build configuration list for PBXNativeTarget "SwiftUIAlternateIcons" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1ECE114023E20B2F009CDE34 /* Debug */,
1ECE114123E20B2F009CDE34 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 1ECE112323E20B2C009CDE34 /* Project object */;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "78BE6068-C0E5-4949-9B7C-BA74B13FEF7A"
type = "1"
version = "2.0">
</Bucket>
Original file line number Diff line number Diff line change
@@ -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>SchemeUserState</key>
<dict>
<key>SwiftUIAlternateIcons.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
37 changes: 37 additions & 0 deletions SwiftUIAlternateIcons/SwiftUIAlternateIcons/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// AppDelegate.swift
// SwiftUIAlternateIcons
//
// Created by Anupam Chugh on 30/01/20.
// Copyright © 2020 iowncode. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {



func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}


}

Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
61 changes: 61 additions & 0 deletions SwiftUIAlternateIcons/SwiftUIAlternateIcons/ContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//
// ContentView.swift
// SwiftUIAlternateIcons
//
// Created by Anupam Chugh on 30/01/20.
// Copyright © 2020 iowncode. All rights reserved.
//

import SwiftUI

struct ContentView: View {

@EnvironmentObject var iconSettings : IconNames

var body: some View {
NavigationView {
Form {
Section{

Picker(selection: $iconSettings.currentIndex, label: Text("Icons"))
{
ForEach(0..<iconSettings.iconNames.count) { index in
//HStack{
Text(self.iconSettings.iconNames[index] ?? "Default")
//Commented due to the NavigationView glitch currently
//.frame(minWidth : 100, alignment: .leading)

// Image(uiImage: UIImage(named: self.iconSettings.iconNames[index] ?? "Default") ?? UIImage())
// .frame(height: 50)
//}
}
}.onReceive([self.iconSettings.currentIndex].publisher.first()) { (value) in

let index = self.iconSettings.iconNames.firstIndex(of: UIApplication.shared.alternateIconName) ?? 0

if index != value{
UIApplication.shared.setAlternateIconName(self.iconSettings.iconNames[value]){ error in
if let error = error {
print(error.localizedDescription)
} else {
print("Success!")
}
}
}
}
}

} .navigationBarTitle("AlternateIcons", displayMode: .inline)
//.buttonStyle(PlainButtonStyle())

}
}
}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}


Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
109 changes: 109 additions & 0 deletions SwiftUIAlternateIcons/SwiftUIAlternateIcons/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?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>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>Shades</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Shades</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>

<key>Sad</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Sad</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>

<key>Taxi</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>Taxi</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>


</dict>
</dict>



<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</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>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
</dict>
</array>
</dict>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
113 changes: 113 additions & 0 deletions SwiftUIAlternateIcons/SwiftUIAlternateIcons/SceneDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
//
// SceneDelegate.swift
// SwiftUIAlternateIcons
//
// Created by Anupam Chugh on 30/01/20.
// Copyright © 2020 iowncode. All rights reserved.
//

import UIKit
import SwiftUI

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?

private(set) static var shared: SceneDelegate?


func iterateThroughDictionary(dict: Dictionary<String, Any>) {

for (key, value) in dict {
if let subDict = value as? Dictionary<String, Any> {
iterateThroughDictionary(dict: subDict)
} else {
print(value)

}
}
}

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {

// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).

// Create the SwiftUI view that provides the window contents.

let contentView = ContentView()

// Use a UIHostingController as window root view controller.
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = UIHostingController(rootView: contentView.environmentObject(IconNames()))
self.window = window
window.makeKeyAndVisible()
}
}

func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}

func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}

func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}

func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}

func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}


}


class IconNames: ObservableObject {
var iconNames: [String?] = [nil]
@Published var currentIndex = 0

init() {
getAlternateIconNames()

if let currentIcon = UIApplication.shared.alternateIconName{
self.currentIndex = iconNames.firstIndex(of: currentIcon) ?? 0
}

}

func getAlternateIconNames()
{
if let icons = Bundle.main.object(forInfoDictionaryKey: "CFBundleIcons") as? [String: Any],
let alternateIcons = icons["CFBundleAlternateIcons"] as? [String: Any]
{

for (_, value) in alternateIcons{

guard let iconList = value as? Dictionary<String,Any> else{return}
guard let iconFiles = iconList["CFBundleIconFiles"] as? [String]
else{return}

guard let icon = iconFiles.first else{return}
iconNames.append(icon)

}
}
}
}

0 comments on commit eca1f95

Please sign in to comment.