diff --git a/0243-tca-tour-pt1/Counter/Counter.xcodeproj/project.pbxproj b/0243-tca-tour-pt1/Counter/Counter.xcodeproj/project.pbxproj new file mode 100644 index 00000000..225818eb --- /dev/null +++ b/0243-tca-tour-pt1/Counter/Counter.xcodeproj/project.pbxproj @@ -0,0 +1,503 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 56; + objects = { + +/* Begin PBXBuildFile section */ + CA6D661F2A66D3D000B2A77A /* CounterApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA6D661E2A66D3D000B2A77A /* CounterApp.swift */; }; + CA6D66212A66D3D000B2A77A /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA6D66202A66D3D000B2A77A /* ContentView.swift */; }; + CA6D66232A66D3D300B2A77A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CA6D66222A66D3D300B2A77A /* Assets.xcassets */; }; + CA6D66262A66D3D300B2A77A /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CA6D66252A66D3D300B2A77A /* Preview Assets.xcassets */; }; + CA6D66302A66D3D300B2A77A /* CounterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA6D662F2A66D3D300B2A77A /* CounterTests.swift */; }; + CA6D665F2A683AA600B2A77A /* ComposableArchitecture in Frameworks */ = {isa = PBXBuildFile; productRef = CA6D665E2A683AA600B2A77A /* ComposableArchitecture */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + CA6D662C2A66D3D300B2A77A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = CA6D66132A66D3D000B2A77A /* Project object */; + proxyType = 1; + remoteGlobalIDString = CA6D661A2A66D3D000B2A77A; + remoteInfo = Counter; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + CA6D661B2A66D3D000B2A77A /* Counter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Counter.app; sourceTree = BUILT_PRODUCTS_DIR; }; + CA6D661E2A66D3D000B2A77A /* CounterApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CounterApp.swift; sourceTree = ""; }; + CA6D66202A66D3D000B2A77A /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + CA6D66222A66D3D300B2A77A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + CA6D66252A66D3D300B2A77A /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + CA6D662B2A66D3D300B2A77A /* CounterTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CounterTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + CA6D662F2A66D3D300B2A77A /* CounterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CounterTests.swift; sourceTree = ""; }; + CA6D66482A66D3F400B2A77A /* Counter.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = Counter.xctestplan; sourceTree = ""; }; + CA6D665C2A683A6B00B2A77A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + CA6D66182A66D3D000B2A77A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + CA6D665F2A683AA600B2A77A /* ComposableArchitecture in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + CA6D66282A66D3D300B2A77A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + CA6D66122A66D3D000B2A77A = { + isa = PBXGroup; + children = ( + CA6D661D2A66D3D000B2A77A /* Counter */, + CA6D662E2A66D3D300B2A77A /* CounterTests */, + CA6D661C2A66D3D000B2A77A /* Products */, + ); + sourceTree = ""; + }; + CA6D661C2A66D3D000B2A77A /* Products */ = { + isa = PBXGroup; + children = ( + CA6D661B2A66D3D000B2A77A /* Counter.app */, + CA6D662B2A66D3D300B2A77A /* CounterTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + CA6D661D2A66D3D000B2A77A /* Counter */ = { + isa = PBXGroup; + children = ( + CA6D665C2A683A6B00B2A77A /* Info.plist */, + CA6D661E2A66D3D000B2A77A /* CounterApp.swift */, + CA6D66202A66D3D000B2A77A /* ContentView.swift */, + CA6D66222A66D3D300B2A77A /* Assets.xcassets */, + CA6D66242A66D3D300B2A77A /* Preview Content */, + ); + path = Counter; + sourceTree = ""; + }; + CA6D66242A66D3D300B2A77A /* Preview Content */ = { + isa = PBXGroup; + children = ( + CA6D66252A66D3D300B2A77A /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + CA6D662E2A66D3D300B2A77A /* CounterTests */ = { + isa = PBXGroup; + children = ( + CA6D66482A66D3F400B2A77A /* Counter.xctestplan */, + CA6D662F2A66D3D300B2A77A /* CounterTests.swift */, + ); + path = CounterTests; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + CA6D661A2A66D3D000B2A77A /* Counter */ = { + isa = PBXNativeTarget; + buildConfigurationList = CA6D663F2A66D3D300B2A77A /* Build configuration list for PBXNativeTarget "Counter" */; + buildPhases = ( + CA6D66172A66D3D000B2A77A /* Sources */, + CA6D66182A66D3D000B2A77A /* Frameworks */, + CA6D66192A66D3D000B2A77A /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Counter; + packageProductDependencies = ( + CA6D665E2A683AA600B2A77A /* ComposableArchitecture */, + ); + productName = Counter; + productReference = CA6D661B2A66D3D000B2A77A /* Counter.app */; + productType = "com.apple.product-type.application"; + }; + CA6D662A2A66D3D300B2A77A /* CounterTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = CA6D66422A66D3D300B2A77A /* Build configuration list for PBXNativeTarget "CounterTests" */; + buildPhases = ( + CA6D66272A66D3D300B2A77A /* Sources */, + CA6D66282A66D3D300B2A77A /* Frameworks */, + CA6D66292A66D3D300B2A77A /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + CA6D662D2A66D3D300B2A77A /* PBXTargetDependency */, + ); + name = CounterTests; + productName = CounterTests; + productReference = CA6D662B2A66D3D300B2A77A /* CounterTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + CA6D66132A66D3D000B2A77A /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1500; + LastUpgradeCheck = 1500; + TargetAttributes = { + CA6D661A2A66D3D000B2A77A = { + CreatedOnToolsVersion = 15.0; + }; + CA6D662A2A66D3D300B2A77A = { + CreatedOnToolsVersion = 15.0; + TestTargetID = CA6D661A2A66D3D000B2A77A; + }; + }; + }; + buildConfigurationList = CA6D66162A66D3D000B2A77A /* Build configuration list for PBXProject "Counter" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = CA6D66122A66D3D000B2A77A; + packageReferences = ( + CA6D665D2A683AA600B2A77A /* XCRemoteSwiftPackageReference "swift-composable-architecture" */, + ); + productRefGroup = CA6D661C2A66D3D000B2A77A /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + CA6D661A2A66D3D000B2A77A /* Counter */, + CA6D662A2A66D3D300B2A77A /* CounterTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + CA6D66192A66D3D000B2A77A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CA6D66262A66D3D300B2A77A /* Preview Assets.xcassets in Resources */, + CA6D66232A66D3D300B2A77A /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + CA6D66292A66D3D300B2A77A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + CA6D66172A66D3D000B2A77A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CA6D66212A66D3D000B2A77A /* ContentView.swift in Sources */, + CA6D661F2A66D3D000B2A77A /* CounterApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + CA6D66272A66D3D300B2A77A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CA6D66302A66D3D300B2A77A /* CounterTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + CA6D662D2A66D3D300B2A77A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = CA6D661A2A66D3D000B2A77A /* Counter */; + targetProxy = CA6D662C2A66D3D300B2A77A /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + CA6D663D2A66D3D300B2A77A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + 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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + 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; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + 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 = 17.0; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + CA6D663E2A66D3D300B2A77A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + 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_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + 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; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + 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 = 17.0; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + CA6D66402A66D3D300B2A77A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"Counter/Preview Content\""; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = Counter/Info.plist; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.Counter; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + CA6D66412A66D3D300B2A77A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_ASSET_PATHS = "\"Counter/Preview Content\""; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = Counter/Info.plist; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.Counter; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + CA6D66432A66D3D300B2A77A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.CounterTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Counter.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Counter"; + }; + name = Debug; + }; + CA6D66442A66D3D300B2A77A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 17.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.CounterTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Counter.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Counter"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + CA6D66162A66D3D000B2A77A /* Build configuration list for PBXProject "Counter" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CA6D663D2A66D3D300B2A77A /* Debug */, + CA6D663E2A66D3D300B2A77A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + CA6D663F2A66D3D300B2A77A /* Build configuration list for PBXNativeTarget "Counter" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CA6D66402A66D3D300B2A77A /* Debug */, + CA6D66412A66D3D300B2A77A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + CA6D66422A66D3D300B2A77A /* Build configuration list for PBXNativeTarget "CounterTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CA6D66432A66D3D300B2A77A /* Debug */, + CA6D66442A66D3D300B2A77A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + CA6D665D2A683AA600B2A77A /* XCRemoteSwiftPackageReference "swift-composable-architecture" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/pointfreeco/swift-composable-architecture.git"; + requirement = { + branch = 1.0.0; + kind = branch; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + CA6D665E2A683AA600B2A77A /* ComposableArchitecture */ = { + isa = XCSwiftPackageProductDependency; + package = CA6D665D2A683AA600B2A77A /* XCRemoteSwiftPackageReference "swift-composable-architecture" */; + productName = ComposableArchitecture; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = CA6D66132A66D3D000B2A77A /* Project object */; +} diff --git a/0243-tca-tour-pt1/Counter/Counter.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/0243-tca-tour-pt1/Counter/Counter.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/0243-tca-tour-pt1/Counter/Counter.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/0243-tca-tour-pt1/Counter/Counter.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/0243-tca-tour-pt1/Counter/Counter.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/0243-tca-tour-pt1/Counter/Counter.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/0243-tca-tour-pt1/Counter/Counter.xcodeproj/xcshareddata/xcschemes/Counter.xcscheme b/0243-tca-tour-pt1/Counter/Counter.xcodeproj/xcshareddata/xcschemes/Counter.xcscheme new file mode 100644 index 00000000..c1030c8b --- /dev/null +++ b/0243-tca-tour-pt1/Counter/Counter.xcodeproj/xcshareddata/xcschemes/Counter.xcscheme @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/0243-tca-tour-pt1/Counter/Counter/Assets.xcassets/AccentColor.colorset/Contents.json b/0243-tca-tour-pt1/Counter/Counter/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 00000000..eb878970 --- /dev/null +++ b/0243-tca-tour-pt1/Counter/Counter/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/0243-tca-tour-pt1/Counter/Counter/Assets.xcassets/AppIcon.appiconset/Contents.json b/0243-tca-tour-pt1/Counter/Counter/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..13613e3e --- /dev/null +++ b/0243-tca-tour-pt1/Counter/Counter/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,13 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/0243-tca-tour-pt1/Counter/Counter/Assets.xcassets/Contents.json b/0243-tca-tour-pt1/Counter/Counter/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/0243-tca-tour-pt1/Counter/Counter/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/0243-tca-tour-pt1/Counter/Counter/ContentView.swift b/0243-tca-tour-pt1/Counter/Counter/ContentView.swift new file mode 100644 index 00000000..e5b3388c --- /dev/null +++ b/0243-tca-tour-pt1/Counter/Counter/ContentView.swift @@ -0,0 +1,142 @@ +import ComposableArchitecture +import SwiftUI + +struct NumberFactClient { + var fetch: @Sendable (Int) async throws -> String +} +extension NumberFactClient: DependencyKey { + static let liveValue = Self { number in + let (data, _) = try await URLSession.shared.data( + from: URL(string: "http://www.numbersapi.com/\(number)")! + ) + return String(decoding: data, as: UTF8.self) + } +} +extension DependencyValues { + var numberFact: NumberFactClient { + get { self[NumberFactClient.self] } + set { self[NumberFactClient.self] = newValue } + } +} + +struct CounterFeature: Reducer { + struct State: Equatable { + var count = 0 + var fact: String? + var isLoadingFact = false + var isTimerOn = false + } + enum Action: Equatable { + case decrementButtonTapped + case factResponse(String) + case getFactButtonTapped + case incrementButtonTapped + case timerTicked + case toggleTimerButtonTapped + } + private enum CancelID { + case timer + } + @Dependency(\.continuousClock) var clock + @Dependency(\.numberFact) var numberFact + var body: some ReducerOf { + Reduce { state, action in + switch action { + case .decrementButtonTapped: + state.count -= 1 + state.fact = nil + return .none + + case let .factResponse(fact): + state.fact = fact + state.isLoadingFact = false + return .none + + case .getFactButtonTapped: + state.fact = nil + state.isLoadingFact = true + return .run { [count = state.count] send in + try await send(.factResponse(self.numberFact.fetch(count))) + } + + case .incrementButtonTapped: + state.count += 1 + state.fact = nil + return .none + + case .timerTicked: + state.count += 1 + return .none + + case .toggleTimerButtonTapped: + state.isTimerOn.toggle() + if state.isTimerOn { + return .run { send in + for await _ in self.clock.timer(interval: .seconds(1)) { + await send(.timerTicked) + } + } + .cancellable(id: CancelID.timer) + } else { + return .cancel(id: CancelID.timer) + } + } + } + } +} + +struct ContentView: View { + let store: StoreOf + + var body: some View { + WithViewStore(self.store, observe: { $0 }) { viewStore in + Form { + Section { + Text("\(viewStore.count)") + Button("Decrement") { + viewStore.send(.decrementButtonTapped) + } + Button("Increment") { + viewStore.send(.incrementButtonTapped) + } + } + Section { + Button { + viewStore.send(.getFactButtonTapped) + } label: { + HStack { + Text("Get fact") + if viewStore.isLoadingFact { + Spacer() + ProgressView() + } + } + } + if let fact = viewStore.fact { + Text(fact) + } + } + Section { + if viewStore.isTimerOn { + Button("Stop timer") { + viewStore.send(.toggleTimerButtonTapped) + } + } else { + Button("Start timer") { + viewStore.send(.toggleTimerButtonTapped) + } + } + } + } + } + } +} + +#Preview { + ContentView( + store: Store(initialState: CounterFeature.State()) { + CounterFeature() + ._printChanges() + } + ) +} diff --git a/0243-tca-tour-pt1/Counter/Counter/CounterApp.swift b/0243-tca-tour-pt1/Counter/Counter/CounterApp.swift new file mode 100644 index 00000000..009d067b --- /dev/null +++ b/0243-tca-tour-pt1/Counter/Counter/CounterApp.swift @@ -0,0 +1,15 @@ +import ComposableArchitecture +import SwiftUI + +@main +struct CounterApp: App { + var body: some Scene { + WindowGroup { + ContentView( + store: Store(initialState: CounterFeature.State()) { + CounterFeature() + } + ) + } + } +} diff --git a/0243-tca-tour-pt1/Counter/Counter/Info.plist b/0243-tca-tour-pt1/Counter/Counter/Info.plist new file mode 100644 index 00000000..6a6654d9 --- /dev/null +++ b/0243-tca-tour-pt1/Counter/Counter/Info.plist @@ -0,0 +1,11 @@ + + + + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + + diff --git a/0243-tca-tour-pt1/Counter/Counter/Preview Content/Preview Assets.xcassets/Contents.json b/0243-tca-tour-pt1/Counter/Counter/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/0243-tca-tour-pt1/Counter/Counter/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/0243-tca-tour-pt1/Counter/CounterTests/Counter.xctestplan b/0243-tca-tour-pt1/Counter/CounterTests/Counter.xctestplan new file mode 100644 index 00000000..fbb6844f --- /dev/null +++ b/0243-tca-tour-pt1/Counter/CounterTests/Counter.xctestplan @@ -0,0 +1,28 @@ +{ + "configurations" : [ + { + "id" : "8D5702CD-E99C-4230-92F1-DDEC4444A6B2", + "name" : "Test Scheme Action", + "options" : { + + } + } + ], + "defaultOptions" : { + "targetForVariableExpansion" : { + "containerPath" : "container:Counter.xcodeproj", + "identifier" : "CA6D661A2A66D3D000B2A77A", + "name" : "Counter" + } + }, + "testTargets" : [ + { + "target" : { + "containerPath" : "container:Counter.xcodeproj", + "identifier" : "CA6D662A2A66D3D300B2A77A", + "name" : "CounterTests" + } + } + ], + "version" : 1 +} diff --git a/0243-tca-tour-pt1/Counter/CounterTests/CounterTests.swift b/0243-tca-tour-pt1/Counter/CounterTests/CounterTests.swift new file mode 100644 index 00000000..2e0b6b72 --- /dev/null +++ b/0243-tca-tour-pt1/Counter/CounterTests/CounterTests.swift @@ -0,0 +1,87 @@ +import ComposableArchitecture +import XCTest +@testable import Counter + +@MainActor +final class CounterTests: XCTestCase { + func testCounter() async { + let store = TestStore(initialState: CounterFeature.State()) { + CounterFeature() + } + + await store.send(.incrementButtonTapped) { + $0.count = 1 + } + } + + func testTimer() async throws { + let clock = TestClock() + + let store = TestStore(initialState: CounterFeature.State()) { + CounterFeature() + } withDependencies: { + $0.continuousClock = clock + } + + await store.send(.toggleTimerButtonTapped) { + $0.isTimerOn = true + } + await clock.advance(by: .seconds(1)) + await store.receive(.timerTicked) { + $0.count = 1 + } + await clock.advance(by: .seconds(1)) + await store.receive(.timerTicked) { + $0.count = 2 + } + await store.send(.toggleTimerButtonTapped) { + $0.isTimerOn = false + } + } + + func testGetFact() async { + let store = TestStore(initialState: CounterFeature.State()) { + CounterFeature() + } withDependencies: { + $0.numberFact.fetch = { "\($0) is a great number!" } + } + await store.send(.getFactButtonTapped) { + $0.isLoadingFact = true + } + await store.receive(.factResponse("0 is a great number!")) { + $0.fact = "0 is a great number!" + $0.isLoadingFact = false + } + } + + func testGetFact_Failure() async { + let store = TestStore(initialState: CounterFeature.State()) { + CounterFeature() + } withDependencies: { + $0.numberFact.fetch = { _ in + struct SomeError: Error {} + throw SomeError() + } + } + XCTExpectFailure() + await store.send(.getFactButtonTapped) { + $0.isLoadingFact = true + } + } +} + + + + + + + + + + + + + + + + diff --git a/0243-tca-tour-pt1/README.md b/0243-tca-tour-pt1/README.md new file mode 100644 index 00000000..95581547 --- /dev/null +++ b/0243-tca-tour-pt1/README.md @@ -0,0 +1,5 @@ +## [Point-Free](https://www.pointfree.co) + +> #### This directory contains code from Point-Free Episode: [Tour of the Composable Architecture 1.0: The Basics](https://www.pointfree.co/episodes/ep243-tour-of-the-composable-architecture-1-0-the-basics) +> +> The Composable Architecture has reached a major milestone: version 1.0. To celebrate this release we are doing a fresh tour of the library so that folks can become comfortable building applications with it in its most modern form. We will start with a simple, but substantial application that shows off the basics, before we recreate Apple’s most complex sample project. diff --git a/README.md b/README.md index a9f117ba..4344d9f3 100644 --- a/README.md +++ b/README.md @@ -244,3 +244,4 @@ This repository is the home of code written on episodes of [Point-Free](https:// 1. [Reliable Async Tests: 😳](0240-reliably-testing-async-pt3) 1. [Reliable Async Tests: 🥹](0241-reliably-testing-async-pt4) 1. [Reliable Async Tests: The Point](0242-reliably-testing-async-pt5) +1. [Tour of the Composable Architecture 1.0: The Basics](0243-tca-tour-pt1)