From 96b1bfca83e3170b5396c879d6e31819350564d9 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Tue, 17 Oct 2023 10:54:15 -0700 Subject: [PATCH] wip --- .../project.pbxproj | 488 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../ObservationExplorations.xcscheme | 106 ++++ .../ObservationExplorations/AppView.swift | 43 ++ .../AppView_ObservableObject.swift | 59 +++ .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 13 + .../Assets.xcassets/Contents.json | 6 + .../ObservationExplorations/CounterView.swift | 134 +++++ .../CounterView_ObservableObject.swift | 80 +++ .../CounterView_State.swift | 59 +++ .../ObservationExplorationsApp.swift | 10 + .../Preview Assets.xcassets/Contents.json | 6 + .../ObservationExplorations.xctestplan | 29 ++ .../ObservationExplorationsTests.swift | 36 ++ 0253-observation-pt2/README.md | 5 + README.md | 1 + 18 files changed, 1101 insertions(+) create mode 100644 0253-observation-pt2/ObservationExplorations/ObservationExplorations.xcodeproj/project.pbxproj create mode 100644 0253-observation-pt2/ObservationExplorations/ObservationExplorations.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 0253-observation-pt2/ObservationExplorations/ObservationExplorations.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 0253-observation-pt2/ObservationExplorations/ObservationExplorations.xcodeproj/xcshareddata/xcschemes/ObservationExplorations.xcscheme create mode 100644 0253-observation-pt2/ObservationExplorations/ObservationExplorations/AppView.swift create mode 100644 0253-observation-pt2/ObservationExplorations/ObservationExplorations/AppView_ObservableObject.swift create mode 100644 0253-observation-pt2/ObservationExplorations/ObservationExplorations/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 0253-observation-pt2/ObservationExplorations/ObservationExplorations/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 0253-observation-pt2/ObservationExplorations/ObservationExplorations/Assets.xcassets/Contents.json create mode 100644 0253-observation-pt2/ObservationExplorations/ObservationExplorations/CounterView.swift create mode 100644 0253-observation-pt2/ObservationExplorations/ObservationExplorations/CounterView_ObservableObject.swift create mode 100644 0253-observation-pt2/ObservationExplorations/ObservationExplorations/CounterView_State.swift create mode 100644 0253-observation-pt2/ObservationExplorations/ObservationExplorations/ObservationExplorationsApp.swift create mode 100644 0253-observation-pt2/ObservationExplorations/ObservationExplorations/Preview Content/Preview Assets.xcassets/Contents.json create mode 100644 0253-observation-pt2/ObservationExplorations/ObservationExplorationsTests/ObservationExplorations.xctestplan create mode 100644 0253-observation-pt2/ObservationExplorations/ObservationExplorationsTests/ObservationExplorationsTests.swift create mode 100644 0253-observation-pt2/README.md diff --git a/0253-observation-pt2/ObservationExplorations/ObservationExplorations.xcodeproj/project.pbxproj b/0253-observation-pt2/ObservationExplorations/ObservationExplorations.xcodeproj/project.pbxproj new file mode 100644 index 00000000..8e84484c --- /dev/null +++ b/0253-observation-pt2/ObservationExplorations/ObservationExplorations.xcodeproj/project.pbxproj @@ -0,0 +1,488 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 56; + objects = { + +/* Begin PBXBuildFile section */ + 2AD14E202ACDC3EC0015EB20 /* ObservationExplorationsApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AD14E1F2ACDC3EC0015EB20 /* ObservationExplorationsApp.swift */; }; + 2AD14E222ACDC3EC0015EB20 /* CounterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AD14E212ACDC3EC0015EB20 /* CounterView.swift */; }; + 2AD14E242ACDC3ED0015EB20 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2AD14E232ACDC3ED0015EB20 /* Assets.xcassets */; }; + 2AD14E272ACDC3ED0015EB20 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2AD14E262ACDC3ED0015EB20 /* Preview Assets.xcassets */; }; + 2AD14E312ACDC3ED0015EB20 /* ObservationExplorationsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AD14E302ACDC3ED0015EB20 /* ObservationExplorationsTests.swift */; }; + 2AD14E4D2ACDDA7C0015EB20 /* CounterView_ObservableObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AD14E4C2ACDDA7C0015EB20 /* CounterView_ObservableObject.swift */; }; + 2AD14E4F2ACDDD640015EB20 /* AppView_ObservableObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AD14E4E2ACDDD640015EB20 /* AppView_ObservableObject.swift */; }; + 4B9F507A2ACDD172003E17D0 /* CounterView_State.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B9F50792ACDD172003E17D0 /* CounterView_State.swift */; }; + 4B9F507C2ACDD5C0003E17D0 /* AppView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B9F507B2ACDD5C0003E17D0 /* AppView.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 2AD14E2D2ACDC3ED0015EB20 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2AD14E142ACDC3EC0015EB20 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2AD14E1B2ACDC3EC0015EB20; + remoteInfo = ObservationExplorations; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 2AD14E1C2ACDC3EC0015EB20 /* ObservationExplorations.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ObservationExplorations.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 2AD14E1F2ACDC3EC0015EB20 /* ObservationExplorationsApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObservationExplorationsApp.swift; sourceTree = ""; }; + 2AD14E212ACDC3EC0015EB20 /* CounterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CounterView.swift; sourceTree = ""; }; + 2AD14E232ACDC3ED0015EB20 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 2AD14E262ACDC3ED0015EB20 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 2AD14E2C2ACDC3ED0015EB20 /* ObservationExplorationsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ObservationExplorationsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 2AD14E302ACDC3ED0015EB20 /* ObservationExplorationsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObservationExplorationsTests.swift; sourceTree = ""; }; + 2AD14E492ACDC40B0015EB20 /* ObservationExplorations.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = ObservationExplorations.xctestplan; sourceTree = ""; }; + 2AD14E4C2ACDDA7C0015EB20 /* CounterView_ObservableObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CounterView_ObservableObject.swift; sourceTree = ""; }; + 2AD14E4E2ACDDD640015EB20 /* AppView_ObservableObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppView_ObservableObject.swift; sourceTree = ""; }; + 4B9F50792ACDD172003E17D0 /* CounterView_State.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CounterView_State.swift; sourceTree = ""; }; + 4B9F507B2ACDD5C0003E17D0 /* AppView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppView.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2AD14E192ACDC3EC0015EB20 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2AD14E292ACDC3ED0015EB20 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 2AD14E132ACDC3EC0015EB20 = { + isa = PBXGroup; + children = ( + 2AD14E1E2ACDC3EC0015EB20 /* ObservationExplorations */, + 2AD14E2F2ACDC3ED0015EB20 /* ObservationExplorationsTests */, + 2AD14E1D2ACDC3EC0015EB20 /* Products */, + ); + sourceTree = ""; + }; + 2AD14E1D2ACDC3EC0015EB20 /* Products */ = { + isa = PBXGroup; + children = ( + 2AD14E1C2ACDC3EC0015EB20 /* ObservationExplorations.app */, + 2AD14E2C2ACDC3ED0015EB20 /* ObservationExplorationsTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 2AD14E1E2ACDC3EC0015EB20 /* ObservationExplorations */ = { + isa = PBXGroup; + children = ( + 4B9F507B2ACDD5C0003E17D0 /* AppView.swift */, + 2AD14E4E2ACDDD640015EB20 /* AppView_ObservableObject.swift */, + 4B9F50792ACDD172003E17D0 /* CounterView_State.swift */, + 2AD14E212ACDC3EC0015EB20 /* CounterView.swift */, + 2AD14E4C2ACDDA7C0015EB20 /* CounterView_ObservableObject.swift */, + 2AD14E1F2ACDC3EC0015EB20 /* ObservationExplorationsApp.swift */, + 2AD14E232ACDC3ED0015EB20 /* Assets.xcassets */, + 2AD14E252ACDC3ED0015EB20 /* Preview Content */, + ); + path = ObservationExplorations; + sourceTree = ""; + }; + 2AD14E252ACDC3ED0015EB20 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 2AD14E262ACDC3ED0015EB20 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + 2AD14E2F2ACDC3ED0015EB20 /* ObservationExplorationsTests */ = { + isa = PBXGroup; + children = ( + 2AD14E492ACDC40B0015EB20 /* ObservationExplorations.xctestplan */, + 2AD14E302ACDC3ED0015EB20 /* ObservationExplorationsTests.swift */, + ); + path = ObservationExplorationsTests; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 2AD14E1B2ACDC3EC0015EB20 /* ObservationExplorations */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2AD14E402ACDC3ED0015EB20 /* Build configuration list for PBXNativeTarget "ObservationExplorations" */; + buildPhases = ( + 2AD14E182ACDC3EC0015EB20 /* Sources */, + 2AD14E192ACDC3EC0015EB20 /* Frameworks */, + 2AD14E1A2ACDC3EC0015EB20 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ObservationExplorations; + productName = ObservationExplorations; + productReference = 2AD14E1C2ACDC3EC0015EB20 /* ObservationExplorations.app */; + productType = "com.apple.product-type.application"; + }; + 2AD14E2B2ACDC3ED0015EB20 /* ObservationExplorationsTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2AD14E432ACDC3ED0015EB20 /* Build configuration list for PBXNativeTarget "ObservationExplorationsTests" */; + buildPhases = ( + 2AD14E282ACDC3ED0015EB20 /* Sources */, + 2AD14E292ACDC3ED0015EB20 /* Frameworks */, + 2AD14E2A2ACDC3ED0015EB20 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 2AD14E2E2ACDC3ED0015EB20 /* PBXTargetDependency */, + ); + name = ObservationExplorationsTests; + productName = ObservationExplorationsTests; + productReference = 2AD14E2C2ACDC3ED0015EB20 /* ObservationExplorationsTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 2AD14E142ACDC3EC0015EB20 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1500; + LastUpgradeCheck = 1500; + TargetAttributes = { + 2AD14E1B2ACDC3EC0015EB20 = { + CreatedOnToolsVersion = 15.0; + }; + 2AD14E2B2ACDC3ED0015EB20 = { + CreatedOnToolsVersion = 15.0; + TestTargetID = 2AD14E1B2ACDC3EC0015EB20; + }; + }; + }; + buildConfigurationList = 2AD14E172ACDC3EC0015EB20 /* Build configuration list for PBXProject "ObservationExplorations" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 2AD14E132ACDC3EC0015EB20; + productRefGroup = 2AD14E1D2ACDC3EC0015EB20 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 2AD14E1B2ACDC3EC0015EB20 /* ObservationExplorations */, + 2AD14E2B2ACDC3ED0015EB20 /* ObservationExplorationsTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 2AD14E1A2ACDC3EC0015EB20 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2AD14E272ACDC3ED0015EB20 /* Preview Assets.xcassets in Resources */, + 2AD14E242ACDC3ED0015EB20 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2AD14E2A2ACDC3ED0015EB20 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 2AD14E182ACDC3EC0015EB20 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4B9F507C2ACDD5C0003E17D0 /* AppView.swift in Sources */, + 4B9F507A2ACDD172003E17D0 /* CounterView_State.swift in Sources */, + 2AD14E4F2ACDDD640015EB20 /* AppView_ObservableObject.swift in Sources */, + 2AD14E222ACDC3EC0015EB20 /* CounterView.swift in Sources */, + 2AD14E4D2ACDDA7C0015EB20 /* CounterView_ObservableObject.swift in Sources */, + 2AD14E202ACDC3EC0015EB20 /* ObservationExplorationsApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2AD14E282ACDC3ED0015EB20 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2AD14E312ACDC3ED0015EB20 /* ObservationExplorationsTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 2AD14E2E2ACDC3ED0015EB20 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2AD14E1B2ACDC3EC0015EB20 /* ObservationExplorations */; + targetProxy = 2AD14E2D2ACDC3ED0015EB20 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 2AD14E3E2ACDC3ED0015EB20 /* 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; + }; + 2AD14E3F2ACDC3ED0015EB20 /* 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; + }; + 2AD14E412ACDC3ED0015EB20 /* 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 = "\"ObservationExplorations/Preview Content\""; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + 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.ObservationExplorations; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 2AD14E422ACDC3ED0015EB20 /* 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 = "\"ObservationExplorations/Preview Content\""; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + 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.ObservationExplorations; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 2AD14E442ACDC3ED0015EB20 /* 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.ObservationExplorationsTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ObservationExplorations.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/ObservationExplorations"; + }; + name = Debug; + }; + 2AD14E452ACDC3ED0015EB20 /* 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.ObservationExplorationsTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ObservationExplorations.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/ObservationExplorations"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2AD14E172ACDC3EC0015EB20 /* Build configuration list for PBXProject "ObservationExplorations" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2AD14E3E2ACDC3ED0015EB20 /* Debug */, + 2AD14E3F2ACDC3ED0015EB20 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2AD14E402ACDC3ED0015EB20 /* Build configuration list for PBXNativeTarget "ObservationExplorations" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2AD14E412ACDC3ED0015EB20 /* Debug */, + 2AD14E422ACDC3ED0015EB20 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2AD14E432ACDC3ED0015EB20 /* Build configuration list for PBXNativeTarget "ObservationExplorationsTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2AD14E442ACDC3ED0015EB20 /* Debug */, + 2AD14E452ACDC3ED0015EB20 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 2AD14E142ACDC3EC0015EB20 /* Project object */; +} diff --git a/0253-observation-pt2/ObservationExplorations/ObservationExplorations.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/0253-observation-pt2/ObservationExplorations/ObservationExplorations.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/0253-observation-pt2/ObservationExplorations/ObservationExplorations.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/0253-observation-pt2/ObservationExplorations/ObservationExplorations.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/0253-observation-pt2/ObservationExplorations/ObservationExplorations.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/0253-observation-pt2/ObservationExplorations/ObservationExplorations.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/0253-observation-pt2/ObservationExplorations/ObservationExplorations.xcodeproj/xcshareddata/xcschemes/ObservationExplorations.xcscheme b/0253-observation-pt2/ObservationExplorations/ObservationExplorations.xcodeproj/xcshareddata/xcschemes/ObservationExplorations.xcscheme new file mode 100644 index 00000000..8b0ee21f --- /dev/null +++ b/0253-observation-pt2/ObservationExplorations/ObservationExplorations.xcodeproj/xcshareddata/xcschemes/ObservationExplorations.xcscheme @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/0253-observation-pt2/ObservationExplorations/ObservationExplorations/AppView.swift b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/AppView.swift new file mode 100644 index 00000000..9da34226 --- /dev/null +++ b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/AppView.swift @@ -0,0 +1,43 @@ +import SwiftUI + +@Observable +class AppModel { + let tab1 = CounterModel() + let tab2 = CounterModel() + let tab3 = CounterModel() +} + +struct AppView: View { + let model: AppModel + + var body: some View { + let _ = Self._printChanges() + + TabView { + NavigationStack { + CounterView(model: self.model.tab1) + .navigationTitle(Text("Counter 1")) + } + .badge(self.model.tab1.count) + .tabItem { Text("Counter 1") } + + NavigationStack { + CounterView(model: self.model.tab2) + .navigationTitle(Text("Counter 2")) + } + .badge(self.model.tab2.count) + .tabItem { Text("Counter 2") } + + NavigationStack { + CounterView(model: self.model.tab3) + .navigationTitle(Text("Counter 3")) + } + .badge(self.model.tab3.count) + .tabItem { Text("Counter 3") } + } + } +} + +#Preview { + AppView(model: AppModel()) +} diff --git a/0253-observation-pt2/ObservationExplorations/ObservationExplorations/AppView_ObservableObject.swift b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/AppView_ObservableObject.swift new file mode 100644 index 00000000..e55dae07 --- /dev/null +++ b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/AppView_ObservableObject.swift @@ -0,0 +1,59 @@ +import Combine +import SwiftUI + +class AppModel_ObservableObject: ObservableObject { + @Published var tab1 = CounterModel_ObservableObject() + @Published var tab2 = CounterModel_ObservableObject() + @Published var tab3 = CounterModel_ObservableObject() + + private var cancellables: Set = [] + + init() { + self.tab1.$count.sink { [weak self] _ in + self?.objectWillChange.send() + } + .store(in: &self.cancellables) + self.tab2.objectWillChange.sink { [weak self] in + self?.objectWillChange.send() + } + .store(in: &self.cancellables) + self.tab3.objectWillChange.sink { [weak self] in + self?.objectWillChange.send() + } + .store(in: &self.cancellables) + } +} + +struct AppView_ObservableObject: View { + @ObservedObject var model: AppModel_ObservableObject + + + var body: some View { + let _ = Self._printChanges() + + TabView { + NavigationStack { + CounterView_ObservableObject(model: self.model.tab1) + .navigationTitle(Text("Counter 1")) + } + .badge(self.model.tab1.count) + .tabItem { Text("Counter 1") } + + NavigationStack { + CounterView_ObservableObject(model: self.model.tab2) + .navigationTitle(Text("Counter 2")) + } + .tabItem { Text("Counter 2") } + + NavigationStack { + CounterView_ObservableObject(model: self.model.tab3) + .navigationTitle(Text("Counter 3")) + } + .tabItem { Text("Counter 3") } + } + } +} + +#Preview { + AppView_ObservableObject(model: AppModel_ObservableObject()) +} diff --git a/0253-observation-pt2/ObservationExplorations/ObservationExplorations/Assets.xcassets/AccentColor.colorset/Contents.json b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 00000000..eb878970 --- /dev/null +++ b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/0253-observation-pt2/ObservationExplorations/ObservationExplorations/Assets.xcassets/AppIcon.appiconset/Contents.json b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..13613e3e --- /dev/null +++ b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/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/0253-observation-pt2/ObservationExplorations/ObservationExplorations/Assets.xcassets/Contents.json b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/0253-observation-pt2/ObservationExplorations/ObservationExplorations/CounterView.swift b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/CounterView.swift new file mode 100644 index 00000000..6274b9f3 --- /dev/null +++ b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/CounterView.swift @@ -0,0 +1,134 @@ +import Observation +import SwiftUI + +struct Angle { + var radians: Double + var degrees: Double { + @storageRestrictions(initializes: radians) + init(initialValue) { + self.radians = initialValue * .pi / 180 + } + get { self.radians * 180 / .pi } + set { self.radians = newValue * .pi / 180 } + } + init(radians: Double) { + self.radians = radians + } + init(degrees: Double) { + self.degrees = degrees + } +} + +@Observable +class CounterModel { + // private var _count + var count: Int = 0 { + didSet { + print("Count changed to", self.count) + } + } + var isDisplayingSecondsElapsed = true + var secondsElapsed = 0 + private var timerTask: Task? + var isTimerOn: Bool { + self.timerTask != nil + } + + init() { + self.count = 0 + + @Sendable func observe() { + withObservationTracking { + _ = self.count + } onChange: { + Task { + print("Count changed to", self.count) + } + observe() + } + } +// observe() + } + + func decrementButtonTapped() { + self.count -= 1 + } + func incrementButtonTapped() { + self.count += 1 + } + + func startTimerButtonTapped() { + self.timerTask?.cancel() + self.timerTask = Task { @MainActor in + while true { + try await Task.sleep(for: .seconds(1)) + self.secondsElapsed += 1 + print("secondsElapsed", self.secondsElapsed) + } + } + } + + func stopTimerButtonTapped() { + self.timerTask?.cancel() + self.timerTask = nil + } +} + +struct CounterView: View { + @Bindable var model: CounterModel + + var body: some View { + let _ = Self._printChanges() + Form { + Section { + Text(self.model.count.description) + Button("Decrement") { self.model.decrementButtonTapped() } + Button("Increment") { self.model.incrementButtonTapped() } + } header: { + Text("Counter") + } + Section { + if self.model.isDisplayingSecondsElapsed { + Text("Seconds elapsed: \(self.model.secondsElapsed)") + } + if !self.model.isTimerOn { + Button("Start timer") { + self.model.startTimerButtonTapped() + } + } else { + Button { + self.model.stopTimerButtonTapped() + } label: { + HStack { + Text("Stop timer") + Spacer() + ProgressView().id(UUID()) + } + } + } + Toggle(isOn: self.$model.isDisplayingSecondsElapsed) { + Text("Observe seconds elapsed") + } + } header: { + Text("Timer") + } + } + } +} + +#Preview { + CounterView(model: CounterModel()) +} + +struct ObservedView: View { + @State var id = UUID() + let content: () -> Content + + var body: some View { + withObservationTracking { + content() + } onChange: { + self.id = UUID() + } + } +} diff --git a/0253-observation-pt2/ObservationExplorations/ObservationExplorations/CounterView_ObservableObject.swift b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/CounterView_ObservableObject.swift new file mode 100644 index 00000000..ce5c552e --- /dev/null +++ b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/CounterView_ObservableObject.swift @@ -0,0 +1,80 @@ +import SwiftUI + +class CounterModel_ObservableObject: ObservableObject { + @Published var count = 0 + @Published var secondsElapsed = 0 + @Published private var timerTask: Task? + var isTimerOn: Bool { + self.timerTask != nil + } + +// init() { +// self.$count.sink { count in +// self.count != count +// } +// } + + func decrementButtonTapped() { + self.count -= 1 + } + func incrementButtonTapped() { + self.count += 1 + } + + func startTimerButtonTapped() { + self.timerTask?.cancel() + self.timerTask = Task { @MainActor in + while true { + try await Task.sleep(for: .seconds(1)) + self.secondsElapsed += 1 + print("secondsElapsed", self.secondsElapsed) + } + } + } + + func stopTimerButtonTapped() { + self.timerTask?.cancel() + self.timerTask = nil + } +} + +struct CounterView_ObservableObject: View { + @ObservedObject var model: CounterModel_ObservableObject + + var body: some View { + let _ = Self._printChanges() + Form { + Section { + Text(self.model.count.description) + Button("Decrement") { self.model.decrementButtonTapped() } + Button("Increment") { self.model.incrementButtonTapped() } + } header: { + Text("Counter") + } + Section { + //Text("Seconds elapsed: \(self.model.secondsElapsed)") + if !self.model.isTimerOn { + Button("Start timer") { + self.model.startTimerButtonTapped() + } + } else { + Button { + self.model.stopTimerButtonTapped() + } label: { + HStack { + Text("Stop timer") + Spacer() + ProgressView().id(UUID()) + } + } + } + } header: { + Text("Timer") + } + } + } +} + +#Preview { + CounterView_ObservableObject(model: CounterModel_ObservableObject()) +} diff --git a/0253-observation-pt2/ObservationExplorations/ObservationExplorations/CounterView_State.swift b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/CounterView_State.swift new file mode 100644 index 00000000..8a74d5ad --- /dev/null +++ b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/CounterView_State.swift @@ -0,0 +1,59 @@ +import SwiftUI + +struct CounterView_State: View { + @State var count = 0 + @State var isDisplayingSecondsElapsed = false + @State var secondsElapsed = 0 + @State var timerTask: Task? + + var body: some View { + let _ = Self._printChanges() + Form { + Section { + Text(self.count.description) + Button("Decrement") { self.count -= 1 } + Button("Increment") { self.count += 1 } + } header: { + Text("Counter") + } + Section { + if self.isDisplayingSecondsElapsed { + Text("Seconds elapsed: \(self.secondsElapsed)") + } + if self.timerTask == nil { + Button("Start timer") { + self.secondsElapsed = 0 + self.timerTask?.cancel() + self.timerTask = Task { + while true { + try await Task.sleep(for: .seconds(1)) + print("secondsElapsed", self.secondsElapsed) + self.secondsElapsed += 1 + } + } + } + } else { + Button { + self.timerTask?.cancel() + self.timerTask = nil + } label: { + HStack { + Text("Stop timer") + Spacer() + ProgressView().id(UUID()) + } + } + } + Toggle(isOn: self.$isDisplayingSecondsElapsed) { + Text("Display seconds") + } + } header: { + Text("Timer") + } + } + } +} + +#Preview { + CounterView_State() +} diff --git a/0253-observation-pt2/ObservationExplorations/ObservationExplorations/ObservationExplorationsApp.swift b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/ObservationExplorationsApp.swift new file mode 100644 index 00000000..d11972be --- /dev/null +++ b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/ObservationExplorationsApp.swift @@ -0,0 +1,10 @@ +import SwiftUI + +@main +struct ObservationExplorationsApp: App { + var body: some Scene { + WindowGroup { + CounterView(model: CounterModel()) + } + } +} diff --git a/0253-observation-pt2/ObservationExplorations/ObservationExplorations/Preview Content/Preview Assets.xcassets/Contents.json b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/0253-observation-pt2/ObservationExplorations/ObservationExplorations/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/0253-observation-pt2/ObservationExplorations/ObservationExplorationsTests/ObservationExplorations.xctestplan b/0253-observation-pt2/ObservationExplorations/ObservationExplorationsTests/ObservationExplorations.xctestplan new file mode 100644 index 00000000..fb5176aa --- /dev/null +++ b/0253-observation-pt2/ObservationExplorations/ObservationExplorationsTests/ObservationExplorations.xctestplan @@ -0,0 +1,29 @@ +{ + "configurations" : [ + { + "id" : "49AD212A-15DA-46EA-9AD3-B8F6372909AB", + "name" : "Test Scheme Action", + "options" : { + + } + } + ], + "defaultOptions" : { + "targetForVariableExpansion" : { + "containerPath" : "container:ObservationExplorations.xcodeproj", + "identifier" : "2AD14E1B2ACDC3EC0015EB20", + "name" : "ObservationExplorations" + } + }, + "testTargets" : [ + { + "parallelizable" : true, + "target" : { + "containerPath" : "container:ObservationExplorations.xcodeproj", + "identifier" : "2AD14E2B2ACDC3ED0015EB20", + "name" : "ObservationExplorationsTests" + } + } + ], + "version" : 1 +} diff --git a/0253-observation-pt2/ObservationExplorations/ObservationExplorationsTests/ObservationExplorationsTests.swift b/0253-observation-pt2/ObservationExplorations/ObservationExplorationsTests/ObservationExplorationsTests.swift new file mode 100644 index 00000000..0433e7a4 --- /dev/null +++ b/0253-observation-pt2/ObservationExplorations/ObservationExplorationsTests/ObservationExplorationsTests.swift @@ -0,0 +1,36 @@ +// +// ObservationExplorationsTests.swift +// ObservationExplorationsTests +// +// Created by Point-Free on 10/4/23. +// + +import XCTest +@testable import ObservationExplorations + +final class ObservationExplorationsTests: 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. + // Any test you write for XCTest can be annotated as throws and async. + // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. + // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. + } + + 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/0253-observation-pt2/README.md b/0253-observation-pt2/README.md new file mode 100644 index 00000000..5dbca2be --- /dev/null +++ b/0253-observation-pt2/README.md @@ -0,0 +1,5 @@ +## [Point-Free](https://www.pointfree.co) + +> #### This directory contains code from Point-Free Episode: [Observation: The Present](https://www.pointfree.co/episodes/ep253-observation-the-present) +> +> The `@Observable` macro is here and we will see how it improves on nearly every aspect of the old tools in SwiftUI. We will also take a peek behind the curtain to not only get comfortable with the code the macro expands to, but also the actual open source code that powers the framework. diff --git a/README.md b/README.md index 60567a59..ec6e9d0d 100644 --- a/README.md +++ b/README.md @@ -254,3 +254,4 @@ This repository is the home of code written on episodes of [Point-Free](https:// 1. [Testing & Debugging Macros: Part 1](0250-macro-testing-pt1) 1. [Testing & Debugging Macros: Part 2](0251-macro-testing-pt2) 1. [Observation: The Past](0252-observation-pt2) +1. [Observation: The Present](0253-observation-pt3)