From 737dfa8a873d0fd83d1bcff231a00d684fb8ac1f Mon Sep 17 00:00:00 2001 From: minimusic Date: Wed, 31 Jul 2019 15:18:42 -0700 Subject: [PATCH 1/3] color asset catalog setup --- .../app/PRODUCTNAME.xcodeproj/project.pbxproj | 26 ++++++------ .../Debug/DebugTextStyleViewController.swift | 2 +- .../Views/TableViewContainerCell.swift | 4 +- .../Coordinators/AppCoordinator.swift | 2 +- .../Coordinators/OnboardingCoordinator.swift | 2 +- .../Coordinators/SignInCoordinator.swift | 2 +- .../app/PRODUCTNAME/Resources/Color.swift | 15 ------- .../Accent-Primary.colorset/Contents.json | 20 +++++++++ .../Background-Primary.colorset/Contents.json | 38 ++++++++++++++++++ .../Background-Warning.colorset/Contents.json | 20 +++++++++ .../Contents.json | 0 .../Disabled.colorset/Contents.json | 38 ++++++++++++++++++ .../Enabled.colorset/Contents.json | 38 ++++++++++++++++++ .../{UIImage+Asset.swift => Asset.swift} | 11 ++++- .../AppIcon.appiconset/Contents.json | 5 +++ .../Resources/Images.xcassets/Contents.json | 6 +++ .../logo-kenny-loggins.imageset/Contents.json | 0 .../logo-kenny-loggins.pdf | Bin .../Screens/ContentTabBarViewController.swift | 2 +- .../OnboardingPageViewController.swift | 18 ++++----- .../OnboardingSamplePageViewController.swift | 6 +-- .../OnboardingSamplePageViewModel.swift | 2 +- 22 files changed, 208 insertions(+), 49 deletions(-) delete mode 100644 PRODUCTNAME/app/PRODUCTNAME/Resources/Color.swift create mode 100644 PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Accent-Primary.colorset/Contents.json create mode 100644 PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Background-Primary.colorset/Contents.json create mode 100644 PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Background-Warning.colorset/Contents.json rename PRODUCTNAME/app/PRODUCTNAME/Resources/{Assets.xcassets => Colors.xcassets}/Contents.json (100%) create mode 100644 PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Disabled.colorset/Contents.json create mode 100644 PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Enabled.colorset/Contents.json rename PRODUCTNAME/app/PRODUCTNAME/Resources/Generated/{UIImage+Asset.swift => Asset.swift} (86%) rename PRODUCTNAME/app/PRODUCTNAME/Resources/{Assets.xcassets => Images.xcassets}/AppIcon.appiconset/Contents.json (88%) create mode 100644 PRODUCTNAME/app/PRODUCTNAME/Resources/Images.xcassets/Contents.json rename PRODUCTNAME/app/PRODUCTNAME/Resources/{Assets.xcassets => Images.xcassets}/logo-kenny-loggins.imageset/Contents.json (100%) rename PRODUCTNAME/app/PRODUCTNAME/Resources/{Assets.xcassets => Images.xcassets}/logo-kenny-loggins.imageset/logo-kenny-loggins.pdf (100%) diff --git a/PRODUCTNAME/app/PRODUCTNAME.xcodeproj/project.pbxproj b/PRODUCTNAME/app/PRODUCTNAME.xcodeproj/project.pbxproj index 12bde69..b98e72e 100644 --- a/PRODUCTNAME/app/PRODUCTNAME.xcodeproj/project.pbxproj +++ b/PRODUCTNAME/app/PRODUCTNAME.xcodeproj/project.pbxproj @@ -21,8 +21,9 @@ 2DFF1CF11E8950F000B1AD70 /* ContentCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DFF1CF01E8950F000B1AD70 /* ContentCoordinator.swift */; }; 2DFF1D121E8BE27B00B1AD70 /* OnboardingPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DFF1D111E8BE27B00B1AD70 /* OnboardingPageViewController.swift */; }; 2DFF1D161E8BF38F00B1AD70 /* UIColor+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DFF1D151E8BF38F00B1AD70 /* UIColor+Extensions.swift */; }; - 2DFF1D181E8BF82A00B1AD70 /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DFF1D171E8BF82A00B1AD70 /* Color.swift */; }; 2DFF1D1C1E8C424800B1AD70 /* OnboardingSamplePageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DFF1D1B1E8C424800B1AD70 /* OnboardingSamplePageViewController.swift */; }; + 63423D9022F2408B00539BFD /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 63423D8F22F2408B00539BFD /* Colors.xcassets */; }; + 63423D9222F2441200539BFD /* Asset.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63423D9122F2441100539BFD /* Asset.swift */; }; 63E19DA1AE4BD0875DF235F8 /* Pods_Services.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6D465E6ECC8509BBB6035678 /* Pods_Services.framework */; }; 85083D4AEA7B5B726A79F450 /* Pods_PRODUCTNAME.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8CD9F2E21AB27A0230007885 /* Pods_PRODUCTNAME.framework */; }; 861732D41FA28DB600C14354 /* HideBackButtonTextBehavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = 861732D21FA28DB600C14354 /* HideBackButtonTextBehavior.swift */; }; @@ -59,7 +60,7 @@ 86A65B201FA0F6DB00705C14 /* UserDefaults+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 86A65B1F1FA0F6DB00705C14 /* UserDefaults+Utilities.swift */; }; 959F487642A61EF85C170AF9 /* Pods_PRODUCTNAME_PRODUCTNAMETests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 845339F96003195CE76EA042 /* Pods_PRODUCTNAME_PRODUCTNAMETests.framework */; }; ABC778791DC90B7A00815FB9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABC778781DC90B7A00815FB9 /* AppDelegate.swift */; }; - ABC778801DC90B7A00815FB9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ABC7787F1DC90B7A00815FB9 /* Assets.xcassets */; }; + ABC778801DC90B7A00815FB9 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ABC7787F1DC90B7A00815FB9 /* Images.xcassets */; }; ABC778831DC90B7A00815FB9 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ABC778811DC90B7A00815FB9 /* LaunchScreen.storyboard */; }; ABC7788E1DC90B7A00815FB9 /* PRODUCTNAMETests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABC7788D1DC90B7A00815FB9 /* PRODUCTNAMETests.swift */; }; ABC778DD1DC94EE500815FB9 /* Acknowledgements.plist in Resources */ = {isa = PBXBuildFile; fileRef = ABC778DC1DC94EE500815FB9 /* Acknowledgements.plist */; }; @@ -71,7 +72,6 @@ ABF84F8C1DC99CFD002DB24D /* Appearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF84F8A1DC99CFD002DB24D /* Appearance.swift */; }; ABF84F8D1DC99CFD002DB24D /* StringStyle+PRODUCTNAME.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF84F8B1DC99CFD002DB24D /* StringStyle+PRODUCTNAME.swift */; }; ABF84F911DC99D33002DB24D /* Localized.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF84F8F1DC99D33002DB24D /* Localized.swift */; }; - ABF84F921DC99D33002DB24D /* UIImage+Asset.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF84F901DC99D33002DB24D /* UIImage+Asset.swift */; }; ABF84F9D1DCBA37A002DB24D /* OAuthTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF84F9C1DCBA37A002DB24D /* OAuthTests.swift */; }; ABF84FA01DCBAB1B002DB24D /* TestConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF84F9F1DCBAB1B002DB24D /* TestConstants.swift */; }; ABF84FA41DCBCD89002DB24D /* APIClientTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF84FA31DCBCD89002DB24D /* APIClientTests.swift */; }; @@ -153,9 +153,10 @@ 2DFF1CF01E8950F000B1AD70 /* ContentCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentCoordinator.swift; sourceTree = ""; }; 2DFF1D111E8BE27B00B1AD70 /* OnboardingPageViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingPageViewController.swift; sourceTree = ""; }; 2DFF1D151E8BF38F00B1AD70 /* UIColor+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+Extensions.swift"; sourceTree = ""; }; - 2DFF1D171E8BF82A00B1AD70 /* Color.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Color.swift; sourceTree = ""; }; 2DFF1D1B1E8C424800B1AD70 /* OnboardingSamplePageViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingSamplePageViewController.swift; sourceTree = ""; }; 36045522D92DD8ED3DFB7FC8 /* Pods-PRODUCTNAME-PRODUCTNAMETests.appstore.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PRODUCTNAME-PRODUCTNAMETests.appstore.xcconfig"; path = "Pods/Target Support Files/Pods-PRODUCTNAME-PRODUCTNAMETests/Pods-PRODUCTNAME-PRODUCTNAMETests.appstore.xcconfig"; sourceTree = ""; }; + 63423D8F22F2408B00539BFD /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = ""; }; + 63423D9122F2441100539BFD /* Asset.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Asset.swift; sourceTree = ""; }; 6D465E6ECC8509BBB6035678 /* Pods_Services.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Services.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 7DA6085A924797A53A836C85 /* Pods-PRODUCTNAME.appstore.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PRODUCTNAME.appstore.xcconfig"; path = "Pods/Target Support Files/Pods-PRODUCTNAME/Pods-PRODUCTNAME.appstore.xcconfig"; sourceTree = ""; }; 7F2C2A97F21BF37CEB2498E0 /* Pods_PRODUCTNAMETests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PRODUCTNAMETests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -197,7 +198,7 @@ 9E61F9E4F9A440040EE8DCF0 /* Pods-PRODUCTNAME.sprint.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PRODUCTNAME.sprint.xcconfig"; path = "Pods/Target Support Files/Pods-PRODUCTNAME/Pods-PRODUCTNAME.sprint.xcconfig"; sourceTree = ""; }; ABC778751DC90B7A00815FB9 /* debug-PRODUCTNAME.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "debug-PRODUCTNAME.app"; sourceTree = BUILT_PRODUCTS_DIR; }; ABC778781DC90B7A00815FB9 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - ABC7787F1DC90B7A00815FB9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + ABC7787F1DC90B7A00815FB9 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; ABC778821DC90B7A00815FB9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; ABC778841DC90B7A00815FB9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; ABC778891DC90B7A00815FB9 /* PRODUCTNAMETests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PRODUCTNAMETests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -217,7 +218,6 @@ ABF84F8A1DC99CFD002DB24D /* Appearance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Appearance.swift; sourceTree = ""; }; ABF84F8B1DC99CFD002DB24D /* StringStyle+PRODUCTNAME.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "StringStyle+PRODUCTNAME.swift"; sourceTree = ""; }; ABF84F8F1DC99D33002DB24D /* Localized.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Localized.swift; sourceTree = ""; }; - ABF84F901DC99D33002DB24D /* UIImage+Asset.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImage+Asset.swift"; sourceTree = ""; }; ABF84F9C1DCBA37A002DB24D /* OAuthTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OAuthTests.swift; sourceTree = ""; }; ABF84F9F1DCBAB1B002DB24D /* TestConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestConstants.swift; sourceTree = ""; }; ABF84FA31DCBCD89002DB24D /* APIClientTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = APIClientTests.swift; sourceTree = ""; }; @@ -540,8 +540,8 @@ 209BE2522051C7BB004CF0FF /* Sourcery */, ABC778CD1DC92BC200815FB9 /* xcconfig */, ABC778DC1DC94EE500815FB9 /* Acknowledgements.plist */, - ABC7787F1DC90B7A00815FB9 /* Assets.xcassets */, - 2DFF1D171E8BF82A00B1AD70 /* Color.swift */, + ABC7787F1DC90B7A00815FB9 /* Images.xcassets */, + 63423D8F22F2408B00539BFD /* Colors.xcassets */, ABC778841DC90B7A00815FB9 /* Info.plist */, 00551421206144E200E4CF68 /* InfoPlist.strings */, ABC778811DC90B7A00815FB9 /* LaunchScreen.storyboard */, @@ -598,11 +598,11 @@ ABF84F8E1DC99D33002DB24D /* Generated */ = { isa = PBXGroup; children = ( + 63423D9122F2441100539BFD /* Asset.swift */, 209BE2582051CB4B004CF0FF /* Actionable+AutoConformance.swift */, D9186D83216D397C0049FD3E /* StoryboardScenes.swift */, D9186D84216D397C0049FD3E /* StoryboardSegues.swift */, ABF84F8F1DC99D33002DB24D /* Localized.swift */, - ABF84F901DC99D33002DB24D /* UIImage+Asset.swift */, ); path = Generated; sourceTree = ""; @@ -828,7 +828,8 @@ 209BE2562051C90C004CF0FF /* actionable.swifttemplate in Resources */, ABF84F811DC97653002DB24D /* Localizable.strings in Resources */, ABC778831DC90B7A00815FB9 /* LaunchScreen.storyboard in Resources */, - ABC778801DC90B7A00815FB9 /* Assets.xcassets in Resources */, + ABC778801DC90B7A00815FB9 /* Images.xcassets in Resources */, + 63423D9022F2408B00539BFD /* Colors.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -903,7 +904,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if [ -x \"$PODS_ROOT/SwiftGen/bin/swiftgen\" ]; then\n $PODS_ROOT/SwiftGen/bin/swiftgen xcassets --template swift4 --output PRODUCTNAME/Resources/Generated/UIImage+Asset.swift PRODUCTNAME/Resources/Assets.xcassets\n $PODS_ROOT/SwiftGen/bin/swiftgen strings --template structured-swift4 --output PRODUCTNAME/Resources/Generated/Localized.swift PRODUCTNAME/Resources/Localizable.strings\n $PODS_ROOT/SwiftGen/bin/swiftgen storyboards -t scenes-swift4 PRODUCTNAME/ --output PRODUCTNAME/Resources/Generated/StoryboardScenes.swift\n $PODS_ROOT/SwiftGen/bin/swiftgen storyboards -t segues-swift4 PRODUCTNAME/ --output PRODUCTNAME/Resources/Generated/StoryboardSegues.swift\nfi\n"; + shellScript = "if [ -x \"$PODS_ROOT/SwiftGen/bin/swiftgen\" ]; then\n $PODS_ROOT/SwiftGen/bin/swiftgen xcassets --template swift4 --output PRODUCTNAME/Resources/Generated/Asset.swift PRODUCTNAME/Resources/Images.xcassets PRODUCTNAME/Resources/Colors.xcassets\n $PODS_ROOT/SwiftGen/bin/swiftgen strings --template structured-swift4 --output PRODUCTNAME/Resources/Generated/Localized.swift PRODUCTNAME/Resources/Localizable.strings\n $PODS_ROOT/SwiftGen/bin/swiftgen storyboards -t scenes-swift4 PRODUCTNAME/ --output PRODUCTNAME/Resources/Generated/StoryboardScenes.swift\n $PODS_ROOT/SwiftGen/bin/swiftgen storyboards -t segues-swift4 PRODUCTNAME/ --output PRODUCTNAME/Resources/Generated/StoryboardSegues.swift\nfi\n"; }; 4B79AD4EE86D9527DA2201EB /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; @@ -1090,7 +1091,6 @@ BE28092C1E802893006E50D5 /* GoogleAnalytics.swift in Sources */, ABC778E11DC94F4400815FB9 /* AppLifecycle.swift in Sources */, 2DFF1D161E8BF38F00B1AD70 /* UIColor+Extensions.swift in Sources */, - ABF84F921DC99D33002DB24D /* UIImage+Asset.swift in Sources */, CD09C936207403B0006D3501 /* ProcessInfo+Utilities.swift in Sources */, 209BE2592051CB4B004CF0FF /* Actionable+AutoConformance.swift in Sources */, ABF84F911DC99D33002DB24D /* Localized.swift in Sources */, @@ -1112,7 +1112,7 @@ 862B204E1FA11345007D33BC /* DebugTextStyleViewController.swift in Sources */, 86A65B201FA0F6DB00705C14 /* UserDefaults+Utilities.swift in Sources */, 861732FE1FA29BE600C14354 /* DebugMenuViewController.swift in Sources */, - 2DFF1D181E8BF82A00B1AD70 /* Color.swift in Sources */, + 63423D9222F2441200539BFD /* Asset.swift in Sources */, 861732D51FA28DB600C14354 /* ModalDismissBehavior.swift in Sources */, BE28092A1E802893006E50D5 /* Analytics.swift in Sources */, 2DFF1D121E8BE27B00B1AD70 /* OnboardingPageViewController.swift in Sources */, diff --git a/PRODUCTNAME/app/PRODUCTNAME/Application/Debug/DebugTextStyleViewController.swift b/PRODUCTNAME/app/PRODUCTNAME/Application/Debug/DebugTextStyleViewController.swift index 8c3c50f..9f326b8 100644 --- a/PRODUCTNAME/app/PRODUCTNAME/Application/Debug/DebugTextStyleViewController.swift +++ b/PRODUCTNAME/app/PRODUCTNAME/Application/Debug/DebugTextStyleViewController.swift @@ -40,7 +40,7 @@ final class DebugTextStyleViewController: UIViewController { title = "Text Styles" - view.backgroundColor = .white + view.backgroundColor = Asset.Colors.backgroundPrimary.color view.addSubview(scrollView) scrollView.addSubview(stackView) diff --git a/PRODUCTNAME/app/PRODUCTNAME/Components/Views/TableViewContainerCell.swift b/PRODUCTNAME/app/PRODUCTNAME/Components/Views/TableViewContainerCell.swift index 4727921..d43afdb 100644 --- a/PRODUCTNAME/app/PRODUCTNAME/Components/Views/TableViewContainerCell.swift +++ b/PRODUCTNAME/app/PRODUCTNAME/Components/Views/TableViewContainerCell.swift @@ -29,7 +29,7 @@ public class TableViewContainerCell: UITableViewCell { public lazy var containerView: UIView = { let containerView = UIView() - containerView.backgroundColor = .white + containerView.backgroundColor = Asset.Colors.backgroundPrimary.color containerView.layer.masksToBounds = true return containerView @@ -37,7 +37,7 @@ public class TableViewContainerCell: UITableViewCell { fileprivate let shadowView: UIView = { let shadowView = UIView() - shadowView.backgroundColor = .white + shadowView.backgroundColor = Asset.Colors.backgroundPrimary.color return shadowView }() diff --git a/PRODUCTNAME/app/PRODUCTNAME/Coordinators/AppCoordinator.swift b/PRODUCTNAME/app/PRODUCTNAME/Coordinators/AppCoordinator.swift index d69dbe5..9b66579 100644 --- a/PRODUCTNAME/app/PRODUCTNAME/Coordinators/AppCoordinator.swift +++ b/PRODUCTNAME/app/PRODUCTNAME/Coordinators/AppCoordinator.swift @@ -18,7 +18,7 @@ class AppCoordinator: Coordinator { init(window: UIWindow) { self.window = window let rootController = UIViewController() - rootController.view.backgroundColor = .white + rootController.view.backgroundColor = Asset.Colors.backgroundPrimary.color self.rootController = rootController } diff --git a/PRODUCTNAME/app/PRODUCTNAME/Coordinators/OnboardingCoordinator.swift b/PRODUCTNAME/app/PRODUCTNAME/Coordinators/OnboardingCoordinator.swift index 6c30b4e..1e7ab54 100644 --- a/PRODUCTNAME/app/PRODUCTNAME/Coordinators/OnboardingCoordinator.swift +++ b/PRODUCTNAME/app/PRODUCTNAME/Coordinators/OnboardingCoordinator.swift @@ -63,7 +63,7 @@ extension OnboardingCoordinator { let samplePage = OnboardingSamplePageViewModel( header: L10n.Onboarding.Pages.Sample.heading, body: L10n.Onboarding.Pages.Sample.body, - asset: Asset.logoKennyLoggins + asset: Asset.Images.logoKennyLoggins.image ) return [samplePage, samplePage, samplePage] } diff --git a/PRODUCTNAME/app/PRODUCTNAME/Coordinators/SignInCoordinator.swift b/PRODUCTNAME/app/PRODUCTNAME/Coordinators/SignInCoordinator.swift index d184c03..73aa0e3 100644 --- a/PRODUCTNAME/app/PRODUCTNAME/Coordinators/SignInCoordinator.swift +++ b/PRODUCTNAME/app/PRODUCTNAME/Coordinators/SignInCoordinator.swift @@ -22,7 +22,7 @@ class SignInCoordinator: Coordinator { func start(animated: Bool, completion: VoidClosure?) { // TODO - create and use SignInViewController let vc = UIViewController() - vc.view.backgroundColor = .red + vc.view.backgroundColor = Asset.Colors.backgroundWarning.color self.baseController.present(vc, animated: animated, completion: completion) } diff --git a/PRODUCTNAME/app/PRODUCTNAME/Resources/Color.swift b/PRODUCTNAME/app/PRODUCTNAME/Resources/Color.swift deleted file mode 100644 index 5ad4e05..0000000 --- a/PRODUCTNAME/app/PRODUCTNAME/Resources/Color.swift +++ /dev/null @@ -1,15 +0,0 @@ -// -// Color.swift -// PRODUCTNAME -// -// Created by LEADDEVELOPER on 3/29/17. -// Copyright © 2017 ORGANIZATION. All rights reserved. -// - -enum Color { - - static let lightGray = UIColor.with(red: 170, green: 170, blue: 170) - static let darkGray = UIColor.with(red: 73, green: 73, blue: 73) - static let green = UIColor.with(red: 126, green: 211, blue: 33) - -} diff --git a/PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Accent-Primary.colorset/Contents.json b/PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Accent-Primary.colorset/Contents.json new file mode 100644 index 0000000..adf1f80 --- /dev/null +++ b/PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Accent-Primary.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "126", + "alpha" : "1.000", + "blue" : "33", + "green" : "211" + } + } + } + ] +} \ No newline at end of file diff --git a/PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Background-Primary.colorset/Contents.json b/PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Background-Primary.colorset/Contents.json new file mode 100644 index 0000000..4318a2c --- /dev/null +++ b/PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Background-Primary.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "1.000", + "alpha" : "1.000", + "blue" : "1.000", + "green" : "1.000" + } + } + }, + { + "idiom" : "universal", + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0.000", + "alpha" : "1.000", + "blue" : "0.000", + "green" : "0.000" + } + } + } + ] +} \ No newline at end of file diff --git a/PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Background-Warning.colorset/Contents.json b/PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Background-Warning.colorset/Contents.json new file mode 100644 index 0000000..2e66f9d --- /dev/null +++ b/PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Background-Warning.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "1.000", + "alpha" : "1.000", + "blue" : "0.000", + "green" : "0.000" + } + } + } + ] +} \ No newline at end of file diff --git a/PRODUCTNAME/app/PRODUCTNAME/Resources/Assets.xcassets/Contents.json b/PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Contents.json similarity index 100% rename from PRODUCTNAME/app/PRODUCTNAME/Resources/Assets.xcassets/Contents.json rename to PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Contents.json diff --git a/PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Disabled.colorset/Contents.json b/PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Disabled.colorset/Contents.json new file mode 100644 index 0000000..5160b81 --- /dev/null +++ b/PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Disabled.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "170", + "alpha" : "1.000", + "blue" : "170", + "green" : "170" + } + } + }, + { + "idiom" : "universal", + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0.330", + "alpha" : "1.000", + "blue" : "0.330", + "green" : "0.330" + } + } + } + ] +} \ No newline at end of file diff --git a/PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Enabled.colorset/Contents.json b/PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Enabled.colorset/Contents.json new file mode 100644 index 0000000..90d047b --- /dev/null +++ b/PRODUCTNAME/app/PRODUCTNAME/Resources/Colors.xcassets/Enabled.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "73", + "alpha" : "1.000", + "blue" : "73", + "green" : "73" + } + } + }, + { + "idiom" : "universal", + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "1.000", + "alpha" : "1.000", + "blue" : "1.000", + "green" : "1.000" + } + } + } + ] +} \ No newline at end of file diff --git a/PRODUCTNAME/app/PRODUCTNAME/Resources/Generated/UIImage+Asset.swift b/PRODUCTNAME/app/PRODUCTNAME/Resources/Generated/Asset.swift similarity index 86% rename from PRODUCTNAME/app/PRODUCTNAME/Resources/Generated/UIImage+Asset.swift rename to PRODUCTNAME/app/PRODUCTNAME/Resources/Generated/Asset.swift index 23b8759..d5c7c6e 100644 --- a/PRODUCTNAME/app/PRODUCTNAME/Resources/Generated/UIImage+Asset.swift +++ b/PRODUCTNAME/app/PRODUCTNAME/Resources/Generated/Asset.swift @@ -18,7 +18,16 @@ // swiftlint:disable identifier_name line_length nesting type_body_length type_name internal enum Asset { - internal static let logoKennyLoggins = ImageAsset(name: "logo-kenny-loggins") + internal enum Colors { + internal static let accentPrimary = ColorAsset(name: "Accent-Primary") + internal static let backgroundPrimary = ColorAsset(name: "Background-Primary") + internal static let backgroundWarning = ColorAsset(name: "Background-Warning") + internal static let disabled = ColorAsset(name: "Disabled") + internal static let enabled = ColorAsset(name: "Enabled") + } + internal enum Images { + internal static let logoKennyLoggins = ImageAsset(name: "logo-kenny-loggins") + } } // swiftlint:enable identifier_name line_length nesting type_body_length type_name diff --git a/PRODUCTNAME/app/PRODUCTNAME/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json b/PRODUCTNAME/app/PRODUCTNAME/Resources/Images.xcassets/AppIcon.appiconset/Contents.json similarity index 88% rename from PRODUCTNAME/app/PRODUCTNAME/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json rename to PRODUCTNAME/app/PRODUCTNAME/Resources/Images.xcassets/AppIcon.appiconset/Contents.json index b8236c6..19882d5 100644 --- a/PRODUCTNAME/app/PRODUCTNAME/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/PRODUCTNAME/app/PRODUCTNAME/Resources/Images.xcassets/AppIcon.appiconset/Contents.json @@ -39,6 +39,11 @@ "idiom" : "iphone", "size" : "60x60", "scale" : "3x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/PRODUCTNAME/app/PRODUCTNAME/Resources/Images.xcassets/Contents.json b/PRODUCTNAME/app/PRODUCTNAME/Resources/Images.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/PRODUCTNAME/app/PRODUCTNAME/Resources/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/PRODUCTNAME/app/PRODUCTNAME/Resources/Assets.xcassets/logo-kenny-loggins.imageset/Contents.json b/PRODUCTNAME/app/PRODUCTNAME/Resources/Images.xcassets/logo-kenny-loggins.imageset/Contents.json similarity index 100% rename from PRODUCTNAME/app/PRODUCTNAME/Resources/Assets.xcassets/logo-kenny-loggins.imageset/Contents.json rename to PRODUCTNAME/app/PRODUCTNAME/Resources/Images.xcassets/logo-kenny-loggins.imageset/Contents.json diff --git a/PRODUCTNAME/app/PRODUCTNAME/Resources/Assets.xcassets/logo-kenny-loggins.imageset/logo-kenny-loggins.pdf b/PRODUCTNAME/app/PRODUCTNAME/Resources/Images.xcassets/logo-kenny-loggins.imageset/logo-kenny-loggins.pdf similarity index 100% rename from PRODUCTNAME/app/PRODUCTNAME/Resources/Assets.xcassets/logo-kenny-loggins.imageset/logo-kenny-loggins.pdf rename to PRODUCTNAME/app/PRODUCTNAME/Resources/Images.xcassets/logo-kenny-loggins.imageset/logo-kenny-loggins.pdf diff --git a/PRODUCTNAME/app/PRODUCTNAME/Screens/ContentTabBarViewController.swift b/PRODUCTNAME/app/PRODUCTNAME/Screens/ContentTabBarViewController.swift index 647a89d..d8ab21c 100644 --- a/PRODUCTNAME/app/PRODUCTNAME/Screens/ContentTabBarViewController.swift +++ b/PRODUCTNAME/app/PRODUCTNAME/Screens/ContentTabBarViewController.swift @@ -12,7 +12,7 @@ class ContentTabBarViewController: UITabBarController { override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = .white + view.backgroundColor = Asset.Colors.backgroundPrimary.color } } diff --git a/PRODUCTNAME/app/PRODUCTNAME/Screens/Onboarding/OnboardingPageViewController.swift b/PRODUCTNAME/app/PRODUCTNAME/Screens/Onboarding/OnboardingPageViewController.swift index 7a33f64..ba5a408 100644 --- a/PRODUCTNAME/app/PRODUCTNAME/Screens/Onboarding/OnboardingPageViewController.swift +++ b/PRODUCTNAME/app/PRODUCTNAME/Screens/Onboarding/OnboardingPageViewController.swift @@ -17,8 +17,8 @@ class OnboardingPageViewController: UIViewController { fileprivate let skipButton: UIButton = { let button = UIButton() button.bonMotStyle = .body - button.bonMotStyle?.color = Color.darkGray - button.setTitleColor(Color.darkGray.highlighted, for: .highlighted) + button.bonMotStyle?.color = Asset.Colors.enabled.color + button.setTitleColor(Asset.Colors.enabled.color.highlighted, for: .highlighted) button.styledText = L10n.Onboarding.Buttons.skip return button }() @@ -28,8 +28,8 @@ class OnboardingPageViewController: UIViewController { fileprivate let joinButton: UIButton = { let button = UIButton() button.bonMotStyle = .body - button.bonMotStyle?.color = Color.green - button.setTitleColor(Color.green.highlighted, for: .highlighted) + button.bonMotStyle?.color = Asset.Colors.accentPrimary.color + button.setTitleColor(Asset.Colors.accentPrimary.color.highlighted, for: .highlighted) button.styledText = L10n.Onboarding.Buttons.join return button }() @@ -37,9 +37,9 @@ class OnboardingPageViewController: UIViewController { fileprivate let signInButton: UIButton = { let button = UIButton() button.bonMotStyle = .body - button.bonMotStyle?.color = Color.darkGray + button.bonMotStyle?.color = Asset.Colors.enabled.color button.styledText = L10n.Onboarding.Buttons.signIn - button.setTitleColor(Color.darkGray.highlighted, for: .highlighted) + button.setTitleColor(Asset.Colors.enabled.color.highlighted, for: .highlighted) return button }() weak var delegate: Delegate? @@ -79,7 +79,7 @@ extension OnboardingPageViewController: Actionable { private extension OnboardingPageViewController { func configureView() { - view.backgroundColor = .white + view.backgroundColor = Asset.Colors.backgroundPrimary.color view.addSubview(skipButton) skipButton.addTarget(self, action: #selector(skipTapped), for: .touchUpInside) @@ -92,8 +92,8 @@ private extension OnboardingPageViewController { let pageControlAppearance = UIPageControl.appearance( whenContainedInInstancesOf: [OnboardingPageViewController.self]) - pageControlAppearance.pageIndicatorTintColor = Color.lightGray - pageControlAppearance.currentPageIndicatorTintColor = Color.darkGray + pageControlAppearance.pageIndicatorTintColor = Asset.Colors.disabled.color + pageControlAppearance.currentPageIndicatorTintColor = Asset.Colors.enabled.color view.addSubview(firstHairline) joinButton.addTarget(self, action: #selector(joinTapped), for: .touchUpInside) diff --git a/PRODUCTNAME/app/PRODUCTNAME/Screens/Onboarding/OnboardingSamplePageViewController.swift b/PRODUCTNAME/app/PRODUCTNAME/Screens/Onboarding/OnboardingSamplePageViewController.swift index 5cafd89..f24a24b 100644 --- a/PRODUCTNAME/app/PRODUCTNAME/Screens/Onboarding/OnboardingSamplePageViewController.swift +++ b/PRODUCTNAME/app/PRODUCTNAME/Screens/Onboarding/OnboardingSamplePageViewController.swift @@ -15,7 +15,7 @@ class OnboardingSamplePageViewController: UIViewController { fileprivate let headerLabel: UILabel = { let label = UILabel() label.bonMotStyle = .title1 - label.bonMotStyle?.color = Color.darkGray + label.bonMotStyle?.color = Asset.Colors.enabled.color label.textAlignment = .center return label }() @@ -23,7 +23,7 @@ class OnboardingSamplePageViewController: UIViewController { fileprivate let bodyLabel: UILabel = { let label = UILabel() label.bonMotStyle = .title3 - label.bonMotStyle?.color = Color.darkGray + label.bonMotStyle?.color = Asset.Colors.enabled.color label.textAlignment = .center label.numberOfLines = 0 return label @@ -31,7 +31,7 @@ class OnboardingSamplePageViewController: UIViewController { init(viewModel: OnboardingSamplePageViewModel) { super.init(nibName: nil, bundle: nil) - imageView.image = viewModel.asset?.image + imageView.image = viewModel.asset headerLabel.styledText = viewModel.header bodyLabel.styledText = viewModel.body } diff --git a/PRODUCTNAME/app/PRODUCTNAME/Screens/Onboarding/OnboardingSamplePageViewModel.swift b/PRODUCTNAME/app/PRODUCTNAME/Screens/Onboarding/OnboardingSamplePageViewModel.swift index 7a0cf28..26e990d 100644 --- a/PRODUCTNAME/app/PRODUCTNAME/Screens/Onboarding/OnboardingSamplePageViewModel.swift +++ b/PRODUCTNAME/app/PRODUCTNAME/Screens/Onboarding/OnboardingSamplePageViewModel.swift @@ -10,6 +10,6 @@ struct OnboardingSamplePageViewModel { let header: String let body: String? - let asset: ImageAsset? + let asset: UIImage? } From 53bdd981c49c329bdf4c9cec1498b14be3f7f3b6 Mon Sep 17 00:00:00 2001 From: minimusic Date: Thu, 1 Aug 2019 10:57:29 -0700 Subject: [PATCH 2/3] generate_template.sh --- .../project.pbxproj | 26 ++-- .../Debug/DebugTextStyleViewController.swift | 2 +- .../Views/TableViewContainerCell.swift | 4 +- .../Coordinators/AppCoordinator.swift | 2 +- .../Coordinators/OnboardingCoordinator.swift | 2 +- .../Coordinators/SignInCoordinator.swift | 2 +- .../Resources/Color.swift | 15 --- .../Accent-Primary.colorset/Contents.json | 20 +++ .../Background-Primary.colorset/Contents.json | 38 ++++++ .../Background-Warning.colorset/Contents.json | 20 +++ .../Contents.json | 0 .../Disabled.colorset/Contents.json | 38 ++++++ .../Enabled.colorset/Contents.json | 38 ++++++ .../Resources/Generated/Asset.swift | 117 ++++++++++++++++++ .../AppIcon.appiconset/Contents.json | 5 + .../Resources/Images.xcassets/Contents.json | 6 + .../logo-kenny-loggins.imageset/Contents.json | 0 .../logo-kenny-loggins.pdf | Bin .../Screens/ContentTabBarViewController.swift | 2 +- .../OnboardingPageViewController.swift | 18 +-- .../OnboardingSamplePageViewController.swift | 6 +- .../OnboardingSamplePageViewModel.swift | 2 +- 22 files changed, 315 insertions(+), 48 deletions(-) delete mode 100644 {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Color.swift create mode 100644 {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Accent-Primary.colorset/Contents.json create mode 100644 {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Background-Primary.colorset/Contents.json create mode 100644 {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Background-Warning.colorset/Contents.json rename {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/{Assets.xcassets => Colors.xcassets}/Contents.json (100%) create mode 100644 {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Disabled.colorset/Contents.json create mode 100644 {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Enabled.colorset/Contents.json create mode 100644 {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Generated/Asset.swift rename {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/{Assets.xcassets => Images.xcassets}/AppIcon.appiconset/Contents.json (88%) create mode 100644 {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Images.xcassets/Contents.json rename {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/{Assets.xcassets => Images.xcassets}/logo-kenny-loggins.imageset/Contents.json (100%) rename {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/{Assets.xcassets => Images.xcassets}/logo-kenny-loggins.imageset/logo-kenny-loggins.pdf (100%) diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}.xcodeproj/project.pbxproj b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}.xcodeproj/project.pbxproj index 3f5eb52..1e2876d 100644 --- a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}.xcodeproj/project.pbxproj +++ b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}.xcodeproj/project.pbxproj @@ -21,8 +21,9 @@ 2DFF1CF11E8950F000B1AD70 /* ContentCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DFF1CF01E8950F000B1AD70 /* ContentCoordinator.swift */; }; 2DFF1D121E8BE27B00B1AD70 /* OnboardingPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DFF1D111E8BE27B00B1AD70 /* OnboardingPageViewController.swift */; }; 2DFF1D161E8BF38F00B1AD70 /* UIColor+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DFF1D151E8BF38F00B1AD70 /* UIColor+Extensions.swift */; }; - 2DFF1D181E8BF82A00B1AD70 /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DFF1D171E8BF82A00B1AD70 /* Color.swift */; }; 2DFF1D1C1E8C424800B1AD70 /* OnboardingSamplePageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DFF1D1B1E8C424800B1AD70 /* OnboardingSamplePageViewController.swift */; }; + 63423D9022F2408B00539BFD /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 63423D8F22F2408B00539BFD /* Colors.xcassets */; }; + 63423D9222F2441200539BFD /* Asset.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63423D9122F2441100539BFD /* Asset.swift */; }; 63E19DA1AE4BD0875DF235F8 /* Pods_Services.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6D465E6ECC8509BBB6035678 /* Pods_Services.framework */; }; 85083D4AEA7B5B726A79F450 /* Pods_{{ cookiecutter.project_name | replace(' ', '') }}.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8CD9F2E21AB27A0230007885 /* Pods_{{ cookiecutter.project_name | replace(' ', '') }}.framework */; }; 861732D41FA28DB600C14354 /* HideBackButtonTextBehavior.swift in Sources */ = {isa = PBXBuildFile; fileRef = 861732D21FA28DB600C14354 /* HideBackButtonTextBehavior.swift */; }; @@ -59,7 +60,7 @@ 86A65B201FA0F6DB00705C14 /* UserDefaults+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 86A65B1F1FA0F6DB00705C14 /* UserDefaults+Utilities.swift */; }; 959F487642A61EF85C170AF9 /* Pods_{{ cookiecutter.project_name | replace(' ', '') }}_{{ cookiecutter.project_name | replace(' ', '') }}Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 845339F96003195CE76EA042 /* Pods_{{ cookiecutter.project_name | replace(' ', '') }}_{{ cookiecutter.project_name | replace(' ', '') }}Tests.framework */; }; ABC778791DC90B7A00815FB9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABC778781DC90B7A00815FB9 /* AppDelegate.swift */; }; - ABC778801DC90B7A00815FB9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ABC7787F1DC90B7A00815FB9 /* Assets.xcassets */; }; + ABC778801DC90B7A00815FB9 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ABC7787F1DC90B7A00815FB9 /* Images.xcassets */; }; ABC778831DC90B7A00815FB9 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ABC778811DC90B7A00815FB9 /* LaunchScreen.storyboard */; }; ABC7788E1DC90B7A00815FB9 /* {{ cookiecutter.project_name | replace(' ', '') }}Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABC7788D1DC90B7A00815FB9 /* {{ cookiecutter.project_name | replace(' ', '') }}Tests.swift */; }; ABC778DD1DC94EE500815FB9 /* Acknowledgements.plist in Resources */ = {isa = PBXBuildFile; fileRef = ABC778DC1DC94EE500815FB9 /* Acknowledgements.plist */; }; @@ -71,7 +72,6 @@ ABF84F8C1DC99CFD002DB24D /* Appearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF84F8A1DC99CFD002DB24D /* Appearance.swift */; }; ABF84F8D1DC99CFD002DB24D /* StringStyle+{{ cookiecutter.project_name | replace(' ', '') }}.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF84F8B1DC99CFD002DB24D /* StringStyle+{{ cookiecutter.project_name | replace(' ', '') }}.swift */; }; ABF84F911DC99D33002DB24D /* Localized.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF84F8F1DC99D33002DB24D /* Localized.swift */; }; - ABF84F921DC99D33002DB24D /* UIImage+Asset.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF84F901DC99D33002DB24D /* UIImage+Asset.swift */; }; ABF84F9D1DCBA37A002DB24D /* OAuthTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF84F9C1DCBA37A002DB24D /* OAuthTests.swift */; }; ABF84FA01DCBAB1B002DB24D /* TestConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF84F9F1DCBAB1B002DB24D /* TestConstants.swift */; }; ABF84FA41DCBCD89002DB24D /* APIClientTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABF84FA31DCBCD89002DB24D /* APIClientTests.swift */; }; @@ -153,9 +153,10 @@ 2DFF1CF01E8950F000B1AD70 /* ContentCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentCoordinator.swift; sourceTree = ""; }; 2DFF1D111E8BE27B00B1AD70 /* OnboardingPageViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingPageViewController.swift; sourceTree = ""; }; 2DFF1D151E8BF38F00B1AD70 /* UIColor+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+Extensions.swift"; sourceTree = ""; }; - 2DFF1D171E8BF82A00B1AD70 /* Color.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Color.swift; sourceTree = ""; }; 2DFF1D1B1E8C424800B1AD70 /* OnboardingSamplePageViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnboardingSamplePageViewController.swift; sourceTree = ""; }; 36045522D92DD8ED3DFB7FC8 /* Pods-{{ cookiecutter.project_name | replace(' ', '') }}-{{ cookiecutter.project_name | replace(' ', '') }}Tests.appstore.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-{{ cookiecutter.project_name | replace(' ', '') }}-{{ cookiecutter.project_name | replace(' ', '') }}Tests.appstore.xcconfig"; path = "Pods/Target Support Files/Pods-{{ cookiecutter.project_name | replace(' ', '') }}-{{ cookiecutter.project_name | replace(' ', '') }}Tests/Pods-{{ cookiecutter.project_name | replace(' ', '') }}-{{ cookiecutter.project_name | replace(' ', '') }}Tests.appstore.xcconfig"; sourceTree = ""; }; + 63423D8F22F2408B00539BFD /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = ""; }; + 63423D9122F2441100539BFD /* Asset.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Asset.swift; sourceTree = ""; }; 6D465E6ECC8509BBB6035678 /* Pods_Services.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Services.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 7DA6085A924797A53A836C85 /* Pods-{{ cookiecutter.project_name | replace(' ', '') }}.appstore.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-{{ cookiecutter.project_name | replace(' ', '') }}.appstore.xcconfig"; path = "Pods/Target Support Files/Pods-{{ cookiecutter.project_name | replace(' ', '') }}/Pods-{{ cookiecutter.project_name | replace(' ', '') }}.appstore.xcconfig"; sourceTree = ""; }; 7F2C2A97F21BF37CEB2498E0 /* Pods_{{ cookiecutter.project_name | replace(' ', '') }}Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_{{ cookiecutter.project_name | replace(' ', '') }}Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -197,7 +198,7 @@ 9E61F9E4F9A440040EE8DCF0 /* Pods-{{ cookiecutter.project_name | replace(' ', '') }}.sprint.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-{{ cookiecutter.project_name | replace(' ', '') }}.sprint.xcconfig"; path = "Pods/Target Support Files/Pods-{{ cookiecutter.project_name | replace(' ', '') }}/Pods-{{ cookiecutter.project_name | replace(' ', '') }}.sprint.xcconfig"; sourceTree = ""; }; ABC778751DC90B7A00815FB9 /* debug-{{ cookiecutter.project_name | replace(' ', '') }}.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "debug-{{ cookiecutter.project_name | replace(' ', '') }}.app"; sourceTree = BUILT_PRODUCTS_DIR; }; ABC778781DC90B7A00815FB9 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - ABC7787F1DC90B7A00815FB9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + ABC7787F1DC90B7A00815FB9 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; ABC778821DC90B7A00815FB9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; ABC778841DC90B7A00815FB9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; ABC778891DC90B7A00815FB9 /* {{ cookiecutter.project_name | replace(' ', '') }}Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = {{ cookiecutter.project_name | replace(' ', '') }}Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -217,7 +218,6 @@ ABF84F8A1DC99CFD002DB24D /* Appearance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Appearance.swift; sourceTree = ""; }; ABF84F8B1DC99CFD002DB24D /* StringStyle+{{ cookiecutter.project_name | replace(' ', '') }}.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "StringStyle+{{ cookiecutter.project_name | replace(' ', '') }}.swift"; sourceTree = ""; }; ABF84F8F1DC99D33002DB24D /* Localized.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Localized.swift; sourceTree = ""; }; - ABF84F901DC99D33002DB24D /* UIImage+Asset.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImage+Asset.swift"; sourceTree = ""; }; ABF84F9C1DCBA37A002DB24D /* OAuthTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OAuthTests.swift; sourceTree = ""; }; ABF84F9F1DCBAB1B002DB24D /* TestConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestConstants.swift; sourceTree = ""; }; ABF84FA31DCBCD89002DB24D /* APIClientTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = APIClientTests.swift; sourceTree = ""; }; @@ -540,8 +540,8 @@ 209BE2522051C7BB004CF0FF /* Sourcery */, ABC778CD1DC92BC200815FB9 /* xcconfig */, ABC778DC1DC94EE500815FB9 /* Acknowledgements.plist */, - ABC7787F1DC90B7A00815FB9 /* Assets.xcassets */, - 2DFF1D171E8BF82A00B1AD70 /* Color.swift */, + ABC7787F1DC90B7A00815FB9 /* Images.xcassets */, + 63423D8F22F2408B00539BFD /* Colors.xcassets */, ABC778841DC90B7A00815FB9 /* Info.plist */, 00551421206144E200E4CF68 /* InfoPlist.strings */, ABC778811DC90B7A00815FB9 /* LaunchScreen.storyboard */, @@ -598,11 +598,11 @@ ABF84F8E1DC99D33002DB24D /* Generated */ = { isa = PBXGroup; children = ( + 63423D9122F2441100539BFD /* Asset.swift */, 209BE2582051CB4B004CF0FF /* Actionable+AutoConformance.swift */, D9186D83216D397C0049FD3E /* StoryboardScenes.swift */, D9186D84216D397C0049FD3E /* StoryboardSegues.swift */, ABF84F8F1DC99D33002DB24D /* Localized.swift */, - ABF84F901DC99D33002DB24D /* UIImage+Asset.swift */, ); path = Generated; sourceTree = ""; @@ -828,7 +828,8 @@ 209BE2562051C90C004CF0FF /* actionable.swifttemplate in Resources */, ABF84F811DC97653002DB24D /* Localizable.strings in Resources */, ABC778831DC90B7A00815FB9 /* LaunchScreen.storyboard in Resources */, - ABC778801DC90B7A00815FB9 /* Assets.xcassets in Resources */, + ABC778801DC90B7A00815FB9 /* Images.xcassets in Resources */, + 63423D9022F2408B00539BFD /* Colors.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -903,7 +904,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if [ -x \"$PODS_ROOT/SwiftGen/bin/swiftgen\" ]; then\n $PODS_ROOT/SwiftGen/bin/swiftgen xcassets --template swift4 --output {{ cookiecutter.project_name | replace(' ', '') }}/Resources/Generated/UIImage+Asset.swift {{ cookiecutter.project_name | replace(' ', '') }}/Resources/Assets.xcassets\n $PODS_ROOT/SwiftGen/bin/swiftgen strings --template structured-swift4 --output {{ cookiecutter.project_name | replace(' ', '') }}/Resources/Generated/Localized.swift {{ cookiecutter.project_name | replace(' ', '') }}/Resources/Localizable.strings\n $PODS_ROOT/SwiftGen/bin/swiftgen storyboards -t scenes-swift4 {{ cookiecutter.project_name | replace(' ', '') }}/ --output {{ cookiecutter.project_name | replace(' ', '') }}/Resources/Generated/StoryboardScenes.swift\n $PODS_ROOT/SwiftGen/bin/swiftgen storyboards -t segues-swift4 {{ cookiecutter.project_name | replace(' ', '') }}/ --output {{ cookiecutter.project_name | replace(' ', '') }}/Resources/Generated/StoryboardSegues.swift\nfi\n"; + shellScript = "if [ -x \"$PODS_ROOT/SwiftGen/bin/swiftgen\" ]; then\n $PODS_ROOT/SwiftGen/bin/swiftgen xcassets --template swift4 --output {{ cookiecutter.project_name | replace(' ', '') }}/Resources/Generated/Asset.swift {{ cookiecutter.project_name | replace(' ', '') }}/Resources/Images.xcassets {{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets\n $PODS_ROOT/SwiftGen/bin/swiftgen strings --template structured-swift4 --output {{ cookiecutter.project_name | replace(' ', '') }}/Resources/Generated/Localized.swift {{ cookiecutter.project_name | replace(' ', '') }}/Resources/Localizable.strings\n $PODS_ROOT/SwiftGen/bin/swiftgen storyboards -t scenes-swift4 {{ cookiecutter.project_name | replace(' ', '') }}/ --output {{ cookiecutter.project_name | replace(' ', '') }}/Resources/Generated/StoryboardScenes.swift\n $PODS_ROOT/SwiftGen/bin/swiftgen storyboards -t segues-swift4 {{ cookiecutter.project_name | replace(' ', '') }}/ --output {{ cookiecutter.project_name | replace(' ', '') }}/Resources/Generated/StoryboardSegues.swift\nfi\n"; }; 4B79AD4EE86D9527DA2201EB /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; @@ -1090,7 +1091,6 @@ BE28092C1E802893006E50D5 /* GoogleAnalytics.swift in Sources */, ABC778E11DC94F4400815FB9 /* AppLifecycle.swift in Sources */, 2DFF1D161E8BF38F00B1AD70 /* UIColor+Extensions.swift in Sources */, - ABF84F921DC99D33002DB24D /* UIImage+Asset.swift in Sources */, CD09C936207403B0006D3501 /* ProcessInfo+Utilities.swift in Sources */, 209BE2592051CB4B004CF0FF /* Actionable+AutoConformance.swift in Sources */, ABF84F911DC99D33002DB24D /* Localized.swift in Sources */, @@ -1112,7 +1112,7 @@ 862B204E1FA11345007D33BC /* DebugTextStyleViewController.swift in Sources */, 86A65B201FA0F6DB00705C14 /* UserDefaults+Utilities.swift in Sources */, 861732FE1FA29BE600C14354 /* DebugMenuViewController.swift in Sources */, - 2DFF1D181E8BF82A00B1AD70 /* Color.swift in Sources */, + 63423D9222F2441200539BFD /* Asset.swift in Sources */, 861732D51FA28DB600C14354 /* ModalDismissBehavior.swift in Sources */, BE28092A1E802893006E50D5 /* Analytics.swift in Sources */, 2DFF1D121E8BE27B00B1AD70 /* OnboardingPageViewController.swift in Sources */, diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Application/Debug/DebugTextStyleViewController.swift b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Application/Debug/DebugTextStyleViewController.swift index c9f2a0e..b2e2b6d 100644 --- a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Application/Debug/DebugTextStyleViewController.swift +++ b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Application/Debug/DebugTextStyleViewController.swift @@ -40,7 +40,7 @@ final class DebugTextStyleViewController: UIViewController { title = "Text Styles" - view.backgroundColor = .white + view.backgroundColor = Asset.Colors.backgroundPrimary.color view.addSubview(scrollView) scrollView.addSubview(stackView) diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Components/Views/TableViewContainerCell.swift b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Components/Views/TableViewContainerCell.swift index a60fb40..a55d542 100644 --- a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Components/Views/TableViewContainerCell.swift +++ b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Components/Views/TableViewContainerCell.swift @@ -29,7 +29,7 @@ public class TableViewContainerCell: UITableViewCell { public lazy var containerView: UIView = { let containerView = UIView() - containerView.backgroundColor = .white + containerView.backgroundColor = Asset.Colors.backgroundPrimary.color containerView.layer.masksToBounds = true return containerView @@ -37,7 +37,7 @@ public class TableViewContainerCell: UITableViewCell { fileprivate let shadowView: UIView = { let shadowView = UIView() - shadowView.backgroundColor = .white + shadowView.backgroundColor = Asset.Colors.backgroundPrimary.color return shadowView }() diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Coordinators/AppCoordinator.swift b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Coordinators/AppCoordinator.swift index 724d09f..c693c61 100644 --- a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Coordinators/AppCoordinator.swift +++ b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Coordinators/AppCoordinator.swift @@ -18,7 +18,7 @@ class AppCoordinator: Coordinator { init(window: UIWindow) { self.window = window let rootController = UIViewController() - rootController.view.backgroundColor = .white + rootController.view.backgroundColor = Asset.Colors.backgroundPrimary.color self.rootController = rootController } diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Coordinators/OnboardingCoordinator.swift b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Coordinators/OnboardingCoordinator.swift index 23224bd..5c70776 100644 --- a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Coordinators/OnboardingCoordinator.swift +++ b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Coordinators/OnboardingCoordinator.swift @@ -63,7 +63,7 @@ extension OnboardingCoordinator { let samplePage = OnboardingSamplePageViewModel( header: L10n.Onboarding.Pages.Sample.heading, body: L10n.Onboarding.Pages.Sample.body, - asset: Asset.logoKennyLoggins + asset: Asset.Images.logoKennyLoggins.image ) return [samplePage, samplePage, samplePage] } diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Coordinators/SignInCoordinator.swift b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Coordinators/SignInCoordinator.swift index ebd4d71..b195ce3 100644 --- a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Coordinators/SignInCoordinator.swift +++ b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Coordinators/SignInCoordinator.swift @@ -22,7 +22,7 @@ class SignInCoordinator: Coordinator { func start(animated: Bool, completion: VoidClosure?) { // TODO - create and use SignInViewController let vc = UIViewController() - vc.view.backgroundColor = .red + vc.view.backgroundColor = Asset.Colors.backgroundWarning.color self.baseController.present(vc, animated: animated, completion: completion) } diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Color.swift b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Color.swift deleted file mode 100644 index 5003524..0000000 --- a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Color.swift +++ /dev/null @@ -1,15 +0,0 @@ -// -// Color.swift -// {{ cookiecutter.project_name | replace(' ', '') }} -// -// Created by {{ cookiecutter.lead_dev }} on 3/29/17. -// Copyright © 2017 {{ cookiecutter.company_name }}. All rights reserved. -// - -enum Color { - - static let lightGray = UIColor.with(red: 170, green: 170, blue: 170) - static let darkGray = UIColor.with(red: 73, green: 73, blue: 73) - static let green = UIColor.with(red: 126, green: 211, blue: 33) - -} diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Accent-Primary.colorset/Contents.json b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Accent-Primary.colorset/Contents.json new file mode 100644 index 0000000..adf1f80 --- /dev/null +++ b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Accent-Primary.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "126", + "alpha" : "1.000", + "blue" : "33", + "green" : "211" + } + } + } + ] +} \ No newline at end of file diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Background-Primary.colorset/Contents.json b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Background-Primary.colorset/Contents.json new file mode 100644 index 0000000..4318a2c --- /dev/null +++ b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Background-Primary.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "1.000", + "alpha" : "1.000", + "blue" : "1.000", + "green" : "1.000" + } + } + }, + { + "idiom" : "universal", + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0.000", + "alpha" : "1.000", + "blue" : "0.000", + "green" : "0.000" + } + } + } + ] +} \ No newline at end of file diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Background-Warning.colorset/Contents.json b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Background-Warning.colorset/Contents.json new file mode 100644 index 0000000..2e66f9d --- /dev/null +++ b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Background-Warning.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "1.000", + "alpha" : "1.000", + "blue" : "0.000", + "green" : "0.000" + } + } + } + ] +} \ No newline at end of file diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Assets.xcassets/Contents.json b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Contents.json similarity index 100% rename from {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Assets.xcassets/Contents.json rename to {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Contents.json diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Disabled.colorset/Contents.json b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Disabled.colorset/Contents.json new file mode 100644 index 0000000..5160b81 --- /dev/null +++ b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Disabled.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "170", + "alpha" : "1.000", + "blue" : "170", + "green" : "170" + } + } + }, + { + "idiom" : "universal", + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0.330", + "alpha" : "1.000", + "blue" : "0.330", + "green" : "0.330" + } + } + } + ] +} \ No newline at end of file diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Enabled.colorset/Contents.json b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Enabled.colorset/Contents.json new file mode 100644 index 0000000..90d047b --- /dev/null +++ b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Colors.xcassets/Enabled.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "73", + "alpha" : "1.000", + "blue" : "73", + "green" : "73" + } + } + }, + { + "idiom" : "universal", + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "1.000", + "alpha" : "1.000", + "blue" : "1.000", + "green" : "1.000" + } + } + } + ] +} \ No newline at end of file diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Generated/Asset.swift b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Generated/Asset.swift new file mode 100644 index 0000000..d5c7c6e --- /dev/null +++ b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Generated/Asset.swift @@ -0,0 +1,117 @@ +// swiftlint:disable all +// Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen + +#if os(OSX) + import AppKit.NSImage + internal typealias AssetColorTypeAlias = NSColor + internal typealias AssetImageTypeAlias = NSImage +#elseif os(iOS) || os(tvOS) || os(watchOS) + import UIKit.UIImage + internal typealias AssetColorTypeAlias = UIColor + internal typealias AssetImageTypeAlias = UIImage +#endif + +// swiftlint:disable superfluous_disable_command +// swiftlint:disable file_length + +// MARK: - Asset Catalogs + +// swiftlint:disable identifier_name line_length nesting type_body_length type_name +internal enum Asset { + internal enum Colors { + internal static let accentPrimary = ColorAsset(name: "Accent-Primary") + internal static let backgroundPrimary = ColorAsset(name: "Background-Primary") + internal static let backgroundWarning = ColorAsset(name: "Background-Warning") + internal static let disabled = ColorAsset(name: "Disabled") + internal static let enabled = ColorAsset(name: "Enabled") + } + internal enum Images { + internal static let logoKennyLoggins = ImageAsset(name: "logo-kenny-loggins") + } +} +// swiftlint:enable identifier_name line_length nesting type_body_length type_name + +// MARK: - Implementation Details + +internal struct ColorAsset { + internal fileprivate(set) var name: String + + @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) + internal var color: AssetColorTypeAlias { + return AssetColorTypeAlias(asset: self) + } +} + +internal extension AssetColorTypeAlias { + @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) + convenience init!(asset: ColorAsset) { + let bundle = Bundle(for: BundleToken.self) + #if os(iOS) || os(tvOS) + self.init(named: asset.name, in: bundle, compatibleWith: nil) + #elseif os(OSX) + self.init(named: NSColor.Name(asset.name), bundle: bundle) + #elseif os(watchOS) + self.init(named: asset.name) + #endif + } +} + +internal struct DataAsset { + internal fileprivate(set) var name: String + + #if os(iOS) || os(tvOS) || os(OSX) + @available(iOS 9.0, tvOS 9.0, OSX 10.11, *) + internal var data: NSDataAsset { + return NSDataAsset(asset: self) + } + #endif +} + +#if os(iOS) || os(tvOS) || os(OSX) +@available(iOS 9.0, tvOS 9.0, OSX 10.11, *) +internal extension NSDataAsset { + convenience init!(asset: DataAsset) { + let bundle = Bundle(for: BundleToken.self) + #if os(iOS) || os(tvOS) + self.init(name: asset.name, bundle: bundle) + #elseif os(OSX) + self.init(name: NSDataAsset.Name(asset.name), bundle: bundle) + #endif + } +} +#endif + +internal struct ImageAsset { + internal fileprivate(set) var name: String + + internal var image: AssetImageTypeAlias { + let bundle = Bundle(for: BundleToken.self) + #if os(iOS) || os(tvOS) + let image = AssetImageTypeAlias(named: name, in: bundle, compatibleWith: nil) + #elseif os(OSX) + let image = bundle.image(forResource: NSImage.Name(name)) + #elseif os(watchOS) + let image = AssetImageTypeAlias(named: name) + #endif + guard let result = image else { fatalError("Unable to load image named \(name).") } + return result + } +} + +internal extension AssetImageTypeAlias { + @available(iOS 1.0, tvOS 1.0, watchOS 1.0, *) + @available(OSX, deprecated, + message: "This initializer is unsafe on macOS, please use the ImageAsset.image property") + convenience init!(asset: ImageAsset) { + #if os(iOS) || os(tvOS) + let bundle = Bundle(for: BundleToken.self) + self.init(named: asset.name, in: bundle, compatibleWith: nil) + #elseif os(OSX) + self.init(named: NSImage.Name(asset.name)) + #elseif os(watchOS) + self.init(named: asset.name) + #endif + } +} + +private final class BundleToken {} diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Images.xcassets/AppIcon.appiconset/Contents.json similarity index 88% rename from {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json rename to {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Images.xcassets/AppIcon.appiconset/Contents.json index b8236c6..19882d5 100644 --- a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Images.xcassets/AppIcon.appiconset/Contents.json @@ -39,6 +39,11 @@ "idiom" : "iphone", "size" : "60x60", "scale" : "3x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Images.xcassets/Contents.json b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Images.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Assets.xcassets/logo-kenny-loggins.imageset/Contents.json b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Images.xcassets/logo-kenny-loggins.imageset/Contents.json similarity index 100% rename from {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Assets.xcassets/logo-kenny-loggins.imageset/Contents.json rename to {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Images.xcassets/logo-kenny-loggins.imageset/Contents.json diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Assets.xcassets/logo-kenny-loggins.imageset/logo-kenny-loggins.pdf b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Images.xcassets/logo-kenny-loggins.imageset/logo-kenny-loggins.pdf similarity index 100% rename from {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Assets.xcassets/logo-kenny-loggins.imageset/logo-kenny-loggins.pdf rename to {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Images.xcassets/logo-kenny-loggins.imageset/logo-kenny-loggins.pdf diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Screens/ContentTabBarViewController.swift b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Screens/ContentTabBarViewController.swift index 4fe92c7..80dfc9f 100644 --- a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Screens/ContentTabBarViewController.swift +++ b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Screens/ContentTabBarViewController.swift @@ -12,7 +12,7 @@ class ContentTabBarViewController: UITabBarController { override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = .white + view.backgroundColor = Asset.Colors.backgroundPrimary.color } } diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Screens/Onboarding/OnboardingPageViewController.swift b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Screens/Onboarding/OnboardingPageViewController.swift index 58eb36b..ec67090 100644 --- a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Screens/Onboarding/OnboardingPageViewController.swift +++ b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Screens/Onboarding/OnboardingPageViewController.swift @@ -17,8 +17,8 @@ class OnboardingPageViewController: UIViewController { fileprivate let skipButton: UIButton = { let button = UIButton() button.bonMotStyle = .body - button.bonMotStyle?.color = Color.darkGray - button.setTitleColor(Color.darkGray.highlighted, for: .highlighted) + button.bonMotStyle?.color = Asset.Colors.enabled.color + button.setTitleColor(Asset.Colors.enabled.color.highlighted, for: .highlighted) button.styledText = L10n.Onboarding.Buttons.skip return button }() @@ -28,8 +28,8 @@ class OnboardingPageViewController: UIViewController { fileprivate let joinButton: UIButton = { let button = UIButton() button.bonMotStyle = .body - button.bonMotStyle?.color = Color.green - button.setTitleColor(Color.green.highlighted, for: .highlighted) + button.bonMotStyle?.color = Asset.Colors.accentPrimary.color + button.setTitleColor(Asset.Colors.accentPrimary.color.highlighted, for: .highlighted) button.styledText = L10n.Onboarding.Buttons.join return button }() @@ -37,9 +37,9 @@ class OnboardingPageViewController: UIViewController { fileprivate let signInButton: UIButton = { let button = UIButton() button.bonMotStyle = .body - button.bonMotStyle?.color = Color.darkGray + button.bonMotStyle?.color = Asset.Colors.enabled.color button.styledText = L10n.Onboarding.Buttons.signIn - button.setTitleColor(Color.darkGray.highlighted, for: .highlighted) + button.setTitleColor(Asset.Colors.enabled.color.highlighted, for: .highlighted) return button }() weak var delegate: Delegate? @@ -79,7 +79,7 @@ extension OnboardingPageViewController: Actionable { private extension OnboardingPageViewController { func configureView() { - view.backgroundColor = .white + view.backgroundColor = Asset.Colors.backgroundPrimary.color view.addSubview(skipButton) skipButton.addTarget(self, action: #selector(skipTapped), for: .touchUpInside) @@ -92,8 +92,8 @@ private extension OnboardingPageViewController { let pageControlAppearance = UIPageControl.appearance( whenContainedInInstancesOf: [OnboardingPageViewController.self]) - pageControlAppearance.pageIndicatorTintColor = Color.lightGray - pageControlAppearance.currentPageIndicatorTintColor = Color.darkGray + pageControlAppearance.pageIndicatorTintColor = Asset.Colors.disabled.color + pageControlAppearance.currentPageIndicatorTintColor = Asset.Colors.enabled.color view.addSubview(firstHairline) joinButton.addTarget(self, action: #selector(joinTapped), for: .touchUpInside) diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Screens/Onboarding/OnboardingSamplePageViewController.swift b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Screens/Onboarding/OnboardingSamplePageViewController.swift index 8b3812c..fd0eca5 100644 --- a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Screens/Onboarding/OnboardingSamplePageViewController.swift +++ b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Screens/Onboarding/OnboardingSamplePageViewController.swift @@ -15,7 +15,7 @@ class OnboardingSamplePageViewController: UIViewController { fileprivate let headerLabel: UILabel = { let label = UILabel() label.bonMotStyle = .title1 - label.bonMotStyle?.color = Color.darkGray + label.bonMotStyle?.color = Asset.Colors.enabled.color label.textAlignment = .center return label }() @@ -23,7 +23,7 @@ class OnboardingSamplePageViewController: UIViewController { fileprivate let bodyLabel: UILabel = { let label = UILabel() label.bonMotStyle = .title3 - label.bonMotStyle?.color = Color.darkGray + label.bonMotStyle?.color = Asset.Colors.enabled.color label.textAlignment = .center label.numberOfLines = 0 return label @@ -31,7 +31,7 @@ class OnboardingSamplePageViewController: UIViewController { init(viewModel: OnboardingSamplePageViewModel) { super.init(nibName: nil, bundle: nil) - imageView.image = viewModel.asset?.image + imageView.image = viewModel.asset headerLabel.styledText = viewModel.header bodyLabel.styledText = viewModel.body } diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Screens/Onboarding/OnboardingSamplePageViewModel.swift b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Screens/Onboarding/OnboardingSamplePageViewModel.swift index 82cb9f9..24d556e 100644 --- a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Screens/Onboarding/OnboardingSamplePageViewModel.swift +++ b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Screens/Onboarding/OnboardingSamplePageViewModel.swift @@ -10,6 +10,6 @@ struct OnboardingSamplePageViewModel { let header: String let body: String? - let asset: ImageAsset? + let asset: UIImage? } From bd562dda96fa27db602a75e10298694e92aeccaf Mon Sep 17 00:00:00 2001 From: minimusic Date: Thu, 1 Aug 2019 13:19:15 -0700 Subject: [PATCH 3/3] ./generate_template.sh for deleted files --- .../Resources/Generated/UIImage+Asset.swift | 108 ------------------ 1 file changed, 108 deletions(-) delete mode 100644 {{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Generated/UIImage+Asset.swift diff --git a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Generated/UIImage+Asset.swift b/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Generated/UIImage+Asset.swift deleted file mode 100644 index 23b8759..0000000 --- a/{{ cookiecutter.project_name | replace(' ', '') }}/app/{{ cookiecutter.project_name | replace(' ', '') }}/Resources/Generated/UIImage+Asset.swift +++ /dev/null @@ -1,108 +0,0 @@ -// swiftlint:disable all -// Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen - -#if os(OSX) - import AppKit.NSImage - internal typealias AssetColorTypeAlias = NSColor - internal typealias AssetImageTypeAlias = NSImage -#elseif os(iOS) || os(tvOS) || os(watchOS) - import UIKit.UIImage - internal typealias AssetColorTypeAlias = UIColor - internal typealias AssetImageTypeAlias = UIImage -#endif - -// swiftlint:disable superfluous_disable_command -// swiftlint:disable file_length - -// MARK: - Asset Catalogs - -// swiftlint:disable identifier_name line_length nesting type_body_length type_name -internal enum Asset { - internal static let logoKennyLoggins = ImageAsset(name: "logo-kenny-loggins") -} -// swiftlint:enable identifier_name line_length nesting type_body_length type_name - -// MARK: - Implementation Details - -internal struct ColorAsset { - internal fileprivate(set) var name: String - - @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) - internal var color: AssetColorTypeAlias { - return AssetColorTypeAlias(asset: self) - } -} - -internal extension AssetColorTypeAlias { - @available(iOS 11.0, tvOS 11.0, watchOS 4.0, OSX 10.13, *) - convenience init!(asset: ColorAsset) { - let bundle = Bundle(for: BundleToken.self) - #if os(iOS) || os(tvOS) - self.init(named: asset.name, in: bundle, compatibleWith: nil) - #elseif os(OSX) - self.init(named: NSColor.Name(asset.name), bundle: bundle) - #elseif os(watchOS) - self.init(named: asset.name) - #endif - } -} - -internal struct DataAsset { - internal fileprivate(set) var name: String - - #if os(iOS) || os(tvOS) || os(OSX) - @available(iOS 9.0, tvOS 9.0, OSX 10.11, *) - internal var data: NSDataAsset { - return NSDataAsset(asset: self) - } - #endif -} - -#if os(iOS) || os(tvOS) || os(OSX) -@available(iOS 9.0, tvOS 9.0, OSX 10.11, *) -internal extension NSDataAsset { - convenience init!(asset: DataAsset) { - let bundle = Bundle(for: BundleToken.self) - #if os(iOS) || os(tvOS) - self.init(name: asset.name, bundle: bundle) - #elseif os(OSX) - self.init(name: NSDataAsset.Name(asset.name), bundle: bundle) - #endif - } -} -#endif - -internal struct ImageAsset { - internal fileprivate(set) var name: String - - internal var image: AssetImageTypeAlias { - let bundle = Bundle(for: BundleToken.self) - #if os(iOS) || os(tvOS) - let image = AssetImageTypeAlias(named: name, in: bundle, compatibleWith: nil) - #elseif os(OSX) - let image = bundle.image(forResource: NSImage.Name(name)) - #elseif os(watchOS) - let image = AssetImageTypeAlias(named: name) - #endif - guard let result = image else { fatalError("Unable to load image named \(name).") } - return result - } -} - -internal extension AssetImageTypeAlias { - @available(iOS 1.0, tvOS 1.0, watchOS 1.0, *) - @available(OSX, deprecated, - message: "This initializer is unsafe on macOS, please use the ImageAsset.image property") - convenience init!(asset: ImageAsset) { - #if os(iOS) || os(tvOS) - let bundle = Bundle(for: BundleToken.self) - self.init(named: asset.name, in: bundle, compatibleWith: nil) - #elseif os(OSX) - self.init(named: NSImage.Name(asset.name)) - #elseif os(watchOS) - self.init(named: asset.name) - #endif - } -} - -private final class BundleToken {}