From a4f38a357363ea784b27aa95fb9533eaaa6bd7cc Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 27 Jul 2020 09:34:00 -0400 Subject: [PATCH] 110 --- .../project.pbxproj | 476 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../DesigningDependencies/AppDelegate.swift | 8 + .../AppIcon.appiconset/Contents.json | 98 ++++ .../Assets.xcassets/Contents.json | 6 + .../Base.lproj/LaunchScreen.storyboard | 25 + .../DesigningDependencies/ContentView.swift | 173 +++++++ .../DesigningDependencies/Info.plist | 60 +++ .../Preview Assets.xcassets/Contents.json | 6 + .../DesigningDependencies/SceneDelegate.swift | 17 + .../DesigningDependenciesTests.swift | 34 ++ .../DesigningDependenciesTests/Info.plist | 22 + 0110-designing-dependencies-pt1/README.md | 5 + README.md | 1 + 15 files changed, 946 insertions(+) create mode 100644 0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies.xcodeproj/project.pbxproj create mode 100644 0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/AppDelegate.swift create mode 100644 0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Assets.xcassets/Contents.json create mode 100644 0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Base.lproj/LaunchScreen.storyboard create mode 100644 0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/ContentView.swift create mode 100644 0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Info.plist create mode 100644 0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Preview Content/Preview Assets.xcassets/Contents.json create mode 100644 0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/SceneDelegate.swift create mode 100644 0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependenciesTests/DesigningDependenciesTests.swift create mode 100644 0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependenciesTests/Info.plist create mode 100644 0110-designing-dependencies-pt1/README.md diff --git a/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies.xcodeproj/project.pbxproj b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies.xcodeproj/project.pbxproj new file mode 100644 index 00000000..2427eecc --- /dev/null +++ b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies.xcodeproj/project.pbxproj @@ -0,0 +1,476 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 2A55622624C8972A00955510 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A55622524C8972A00955510 /* AppDelegate.swift */; }; + 2A55622824C8972A00955510 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A55622724C8972A00955510 /* SceneDelegate.swift */; }; + 2A55622A24C8972A00955510 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A55622924C8972A00955510 /* ContentView.swift */; }; + 2A55622C24C8972B00955510 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2A55622B24C8972B00955510 /* Assets.xcassets */; }; + 2A55622F24C8972B00955510 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2A55622E24C8972B00955510 /* Preview Assets.xcassets */; }; + 2A55623224C8972B00955510 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2A55623024C8972B00955510 /* LaunchScreen.storyboard */; }; + 2A55623D24C8972B00955510 /* DesigningDependenciesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A55623C24C8972B00955510 /* DesigningDependenciesTests.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 2A55623924C8972B00955510 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2A55621A24C8972A00955510 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2A55622124C8972A00955510; + remoteInfo = DesigningDependencies; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 2A55622224C8972A00955510 /* DesigningDependencies.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DesigningDependencies.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 2A55622524C8972A00955510 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 2A55622724C8972A00955510 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 2A55622924C8972A00955510 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 2A55622B24C8972B00955510 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 2A55622E24C8972B00955510 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 2A55623124C8972B00955510 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 2A55623324C8972B00955510 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 2A55623824C8972B00955510 /* DesigningDependenciesTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DesigningDependenciesTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 2A55623C24C8972B00955510 /* DesigningDependenciesTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DesigningDependenciesTests.swift; sourceTree = ""; }; + 2A55623E24C8972B00955510 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2A55621F24C8972A00955510 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2A55623524C8972B00955510 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 2A55621924C8972A00955510 = { + isa = PBXGroup; + children = ( + 2A55622424C8972A00955510 /* DesigningDependencies */, + 2A55623B24C8972B00955510 /* DesigningDependenciesTests */, + 2A55622324C8972A00955510 /* Products */, + ); + sourceTree = ""; + }; + 2A55622324C8972A00955510 /* Products */ = { + isa = PBXGroup; + children = ( + 2A55622224C8972A00955510 /* DesigningDependencies.app */, + 2A55623824C8972B00955510 /* DesigningDependenciesTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 2A55622424C8972A00955510 /* DesigningDependencies */ = { + isa = PBXGroup; + children = ( + 2A55622524C8972A00955510 /* AppDelegate.swift */, + 2A55622724C8972A00955510 /* SceneDelegate.swift */, + 2A55622924C8972A00955510 /* ContentView.swift */, + 2A55622B24C8972B00955510 /* Assets.xcassets */, + 2A55623024C8972B00955510 /* LaunchScreen.storyboard */, + 2A55623324C8972B00955510 /* Info.plist */, + 2A55622D24C8972B00955510 /* Preview Content */, + ); + path = DesigningDependencies; + sourceTree = ""; + }; + 2A55622D24C8972B00955510 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 2A55622E24C8972B00955510 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + 2A55623B24C8972B00955510 /* DesigningDependenciesTests */ = { + isa = PBXGroup; + children = ( + 2A55623C24C8972B00955510 /* DesigningDependenciesTests.swift */, + 2A55623E24C8972B00955510 /* Info.plist */, + ); + path = DesigningDependenciesTests; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 2A55622124C8972A00955510 /* DesigningDependencies */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2A55624124C8972B00955510 /* Build configuration list for PBXNativeTarget "DesigningDependencies" */; + buildPhases = ( + 2A55621E24C8972A00955510 /* Sources */, + 2A55621F24C8972A00955510 /* Frameworks */, + 2A55622024C8972A00955510 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = DesigningDependencies; + productName = DesigningDependencies; + productReference = 2A55622224C8972A00955510 /* DesigningDependencies.app */; + productType = "com.apple.product-type.application"; + }; + 2A55623724C8972B00955510 /* DesigningDependenciesTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2A55624424C8972B00955510 /* Build configuration list for PBXNativeTarget "DesigningDependenciesTests" */; + buildPhases = ( + 2A55623424C8972B00955510 /* Sources */, + 2A55623524C8972B00955510 /* Frameworks */, + 2A55623624C8972B00955510 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 2A55623A24C8972B00955510 /* PBXTargetDependency */, + ); + name = DesigningDependenciesTests; + productName = DesigningDependenciesTests; + productReference = 2A55623824C8972B00955510 /* DesigningDependenciesTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 2A55621A24C8972A00955510 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1160; + LastUpgradeCheck = 1160; + ORGANIZATIONNAME = "Point-Free"; + TargetAttributes = { + 2A55622124C8972A00955510 = { + CreatedOnToolsVersion = 11.6; + }; + 2A55623724C8972B00955510 = { + CreatedOnToolsVersion = 11.6; + TestTargetID = 2A55622124C8972A00955510; + }; + }; + }; + buildConfigurationList = 2A55621D24C8972A00955510 /* Build configuration list for PBXProject "DesigningDependencies" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 2A55621924C8972A00955510; + productRefGroup = 2A55622324C8972A00955510 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 2A55622124C8972A00955510 /* DesigningDependencies */, + 2A55623724C8972B00955510 /* DesigningDependenciesTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 2A55622024C8972A00955510 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2A55623224C8972B00955510 /* LaunchScreen.storyboard in Resources */, + 2A55622F24C8972B00955510 /* Preview Assets.xcassets in Resources */, + 2A55622C24C8972B00955510 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2A55623624C8972B00955510 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 2A55621E24C8972A00955510 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2A55622624C8972A00955510 /* AppDelegate.swift in Sources */, + 2A55622824C8972A00955510 /* SceneDelegate.swift in Sources */, + 2A55622A24C8972A00955510 /* ContentView.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2A55623424C8972B00955510 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2A55623D24C8972B00955510 /* DesigningDependenciesTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 2A55623A24C8972B00955510 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2A55622124C8972A00955510 /* DesigningDependencies */; + targetProxy = 2A55623924C8972B00955510 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 2A55623024C8972B00955510 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 2A55623124C8972B00955510 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 2A55623F24C8972B00955510 /* 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.6; + 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; + }; + 2A55624024C8972B00955510 /* 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.6; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 2A55624224C8972B00955510 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"DesigningDependencies/Preview Content\""; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = DesigningDependencies/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.5; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.DesigningDependencies; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 2A55624324C8972B00955510 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"DesigningDependencies/Preview Content\""; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = DesigningDependencies/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.5; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.DesigningDependencies; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 2A55624524C8972B00955510 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = DesigningDependenciesTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.6; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.DesigningDependenciesTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DesigningDependencies.app/DesigningDependencies"; + }; + name = Debug; + }; + 2A55624624C8972B00955510 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = DesigningDependenciesTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.6; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.DesigningDependenciesTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DesigningDependencies.app/DesigningDependencies"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2A55621D24C8972A00955510 /* Build configuration list for PBXProject "DesigningDependencies" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2A55623F24C8972B00955510 /* Debug */, + 2A55624024C8972B00955510 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2A55624124C8972B00955510 /* Build configuration list for PBXNativeTarget "DesigningDependencies" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2A55624224C8972B00955510 /* Debug */, + 2A55624324C8972B00955510 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2A55624424C8972B00955510 /* Build configuration list for PBXNativeTarget "DesigningDependenciesTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2A55624524C8972B00955510 /* Debug */, + 2A55624624C8972B00955510 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 2A55621A24C8972A00955510 /* Project object */; +} diff --git a/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..210e1799 --- /dev/null +++ b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/AppDelegate.swift b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/AppDelegate.swift new file mode 100644 index 00000000..1cc418c1 --- /dev/null +++ b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/AppDelegate.swift @@ -0,0 +1,8 @@ +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + return true + } +} diff --git a/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Assets.xcassets/AppIcon.appiconset/Contents.json b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..9221b9bb --- /dev/null +++ b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Assets.xcassets/Contents.json b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Base.lproj/LaunchScreen.storyboard b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..865e9329 --- /dev/null +++ b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/ContentView.swift b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/ContentView.swift new file mode 100644 index 00000000..14190d04 --- /dev/null +++ b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/ContentView.swift @@ -0,0 +1,173 @@ +import Combine +import SwiftUI + +class AppViewModel: ObservableObject { + @Published var isConnected = true + @Published var weatherResults: [WeatherResponse.ConsolidatedWeather] = [] + + var weatherRequestCancellable: AnyCancellable? + + init( + isConnected: Bool = true, + weatherClient: WeatherClientProtocol = WeatherClient() + ) { + self.isConnected = isConnected + + self.weatherRequestCancellable = weatherClient + .weather() + .sink( + receiveCompletion: { _ in }, + receiveValue: { [weak self] response in + self?.weatherResults = response.consolidatedWeather + }) + } +} + +struct ContentView: View { + @ObservedObject var viewModel: AppViewModel + + var body: some View { + NavigationView { + ZStack(alignment: .bottom) { + ZStack(alignment: .bottomTrailing) { + List { + ForEach(self.viewModel.weatherResults, id: \.id) { weather in + VStack(alignment: .leading) { + Text(dayOfWeekFormatter.string(from: weather.applicableDate).capitalized) + .font(.title) + + Text("Current temp: \(weather.theTemp, specifier: "%.1f")°C") + Text("Max temp: \(weather.maxTemp, specifier: "%.1f")°C") + Text("Min temp: \(weather.minTemp, specifier: "%.1f")°C") + } + } + } + + Button( + action: { } + ) { + Image(systemName: "location.fill") + .foregroundColor(.white) + .frame(width: 60, height: 60) + } + .background(Color.black) + .clipShape(Circle()) + .padding() + } + + if !self.viewModel.isConnected { + HStack { + Image(systemName: "exclamationmark.octagon.fill") + + Text("Not connected to internet") + } + .foregroundColor(.white) + .padding() + .background(Color.red) + } + } + .navigationBarTitle("Weather") + } + } +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView( + viewModel: AppViewModel( +// weatherClient: MockWeatherClient() + weatherClient: MockWeatherClient( + _weather: { + Just(WeatherResponse(consolidatedWeather: [])) + .setFailureType(to: Error.self) + .eraseToAnyPublisher() + }, + _searchLocations: { _ in + Just([]) + .setFailureType(to: Error.self) + .eraseToAnyPublisher() + } + ) + ) + ) + } +} + + +let dayOfWeekFormatter: DateFormatter = { + let formatter = DateFormatter() + formatter.dateFormat = "EEEE" + return formatter +}() + + +import CoreLocation +import Foundation + +struct Location {} + +protocol WeatherClientProtocol { + func weather() -> AnyPublisher + func searchLocations(coordinate: CLLocationCoordinate2D) -> AnyPublisher<[Location], Error> +} + +struct WeatherClient: WeatherClientProtocol { + func weather() -> AnyPublisher { + URLSession.shared.dataTaskPublisher(for: URL(string: "https://www.metaweather.com/api/location/2459115")!) + .map { data, _ in data } + .decode(type: WeatherResponse.self, decoder: weatherJsonDecoder) + .receive(on: DispatchQueue.main) + .eraseToAnyPublisher() + } +} + +//struct MockWeatherClient: WeatherClientProtocol { +// func weather() -> AnyPublisher { +// Just( +// WeatherResponse( +// consolidatedWeather: [ +// .init(applicableDate: Date(), id: 1, maxTemp: 30, minTemp: 10, theTemp: 20), +// .init(applicableDate: Date().addingTimeInterval(86400), id: 2, maxTemp: -10, minTemp: -30, theTemp: -20), +// ] +// ) +// ) +// .setFailureType(to: Error.self) +// .delay(for: 2, scheduler: DispatchQueue.main) +//// Fail(error: NSError(domain: "", code: 1, userInfo: nil)) +// .eraseToAnyPublisher() +// } +//} + +struct MockWeatherClient: WeatherClientProtocol { + var _weather: () -> AnyPublisher + var _searchLocations: (CLLocationCoordinate2D) -> AnyPublisher<[Location], Error> + + func weather() -> AnyPublisher { + self._weather() + } + + func searchLocations(coordinate: CLLocationCoordinate2D) -> AnyPublisher<[Location], Error> { + self._searchLocations(coordinate) + } +} + +struct WeatherResponse: Decodable, Equatable { + var consolidatedWeather: [ConsolidatedWeather] + + struct ConsolidatedWeather: Decodable, Equatable { + var applicableDate: Date + var id: Int + var maxTemp: Double + var minTemp: Double + var theTemp: Double + } +} + +private let weatherJsonDecoder: JSONDecoder = { + let jsonDecoder = JSONDecoder() + let formatter = DateFormatter() + formatter.dateFormat = "yyyy-MM-dd" + jsonDecoder.dateDecodingStrategy = .formatted(formatter) + jsonDecoder.keyDecodingStrategy = .convertFromSnakeCase + return jsonDecoder +}() diff --git a/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Info.plist b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Info.plist new file mode 100644 index 00000000..9742bf0f --- /dev/null +++ b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Info.plist @@ -0,0 +1,60 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + + + + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Preview Content/Preview Assets.xcassets/Contents.json b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/SceneDelegate.swift b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/SceneDelegate.swift new file mode 100644 index 00000000..8d22b3bb --- /dev/null +++ b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependencies/SceneDelegate.swift @@ -0,0 +1,17 @@ +import SwiftUI +import UIKit + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + var window: UIWindow? + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + let contentView = ContentView(viewModel: AppViewModel()) + + if let windowScene = scene as? UIWindowScene { + let window = UIWindow(windowScene: windowScene) + window.rootViewController = UIHostingController(rootView: contentView) + self.window = window + window.makeKeyAndVisible() + } + } +} diff --git a/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependenciesTests/DesigningDependenciesTests.swift b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependenciesTests/DesigningDependenciesTests.swift new file mode 100644 index 00000000..bb8f23f7 --- /dev/null +++ b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependenciesTests/DesigningDependenciesTests.swift @@ -0,0 +1,34 @@ +// +// DesigningDependenciesTests.swift +// DesigningDependenciesTests +// +// Created by Point-Free on 7/22/20. +// Copyright © 2020 Point-Free. All rights reserved. +// + +import XCTest +@testable import DesigningDependencies + +class DesigningDependenciesTests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testPerformanceExample() throws { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependenciesTests/Info.plist b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependenciesTests/Info.plist new file mode 100644 index 00000000..64d65ca4 --- /dev/null +++ b/0110-designing-dependencies-pt1/DesigningDependencies/DesigningDependenciesTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/0110-designing-dependencies-pt1/README.md b/0110-designing-dependencies-pt1/README.md new file mode 100644 index 00000000..88470cbc --- /dev/null +++ b/0110-designing-dependencies-pt1/README.md @@ -0,0 +1,5 @@ +## [Point-Free](https://www.pointfree.co) + +> #### This directory contains code from Point-Free Episode: [Designing Dependencies: The Problem](https://www.pointfree.co/episodes/ep110-designing-dependencies-the-problem) +> +> Let’s take a moment to properly define what a dependency is and understand why they add so much complexity to our code. We will begin building a moderately complex application with three dependencies, and see how it complicates development, and what we can do about it. diff --git a/README.md b/README.md index 84d28033..2b1a433b 100644 --- a/README.md +++ b/README.md @@ -112,3 +112,4 @@ This repository is the home of code written on episodes of 1. [Composable SwiftUI Bindings: The Problem](0107-composable-bindings-pt1) 1. [Composable SwiftUI Bindings: Case Paths](0108-composable-bindings-pt2) 1. [Composable SwiftUI Bindings: The Point](0109-composable-bindings-pt3) +1. [Designing Dependencies: The Problem](0110-designing-dependencies-pt1)