diff --git a/AzzeolStudy.xcworkspace/contents.xcworkspacedata b/AzzeolStudy.xcworkspace/contents.xcworkspacedata index ab0b90d..7cb3c26 100644 --- a/AzzeolStudy.xcworkspace/contents.xcworkspacedata +++ b/AzzeolStudy.xcworkspace/contents.xcworkspacedata @@ -1,6 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SwiftUIMemo/SwiftUIMemo.xcodeproj/project.pbxproj b/SwiftUIMemo/SwiftUIMemo.xcodeproj/project.pbxproj new file mode 100644 index 0000000..339d72c --- /dev/null +++ b/SwiftUIMemo/SwiftUIMemo.xcodeproj/project.pbxproj @@ -0,0 +1,409 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 56; + objects = { + +/* Begin PBXBuildFile section */ + E71DEA7729C2CDA000C81421 /* SwiftUIMemoApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = E71DEA7629C2CDA000C81421 /* SwiftUIMemoApp.swift */; }; + E71DEA7B29C2CDA200C81421 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E71DEA7A29C2CDA200C81421 /* Assets.xcassets */; }; + E71DEA7E29C2CDA200C81421 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E71DEA7D29C2CDA200C81421 /* Preview Assets.xcassets */; }; + E71DEA8029C2CDA200C81421 /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = E71DEA7F29C2CDA200C81421 /* Persistence.swift */; }; + E71DEA8329C2CDA300C81421 /* SwiftUIMemo.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = E71DEA8129C2CDA200C81421 /* SwiftUIMemo.xcdatamodeld */; }; + E71DEA8A29C2CDF300C81421 /* MainListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E71DEA8929C2CDF300C81421 /* MainListView.swift */; }; + E71DEA8E29C2CE9B00C81421 /* Memo.swift in Sources */ = {isa = PBXBuildFile; fileRef = E71DEA8D29C2CE9B00C81421 /* Memo.swift */; }; + E71DEA9029C2CF8C00C81421 /* MemoStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = E71DEA8F29C2CF8C00C81421 /* MemoStore.swift */; }; + E71DEA9529C3088400C81421 /* MemoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E71DEA9429C3088400C81421 /* MemoCell.swift */; }; + E71DEA9729C308F400C81421 /* ComposeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E71DEA9629C308F400C81421 /* ComposeView.swift */; }; + E71DEA9929C3EF2000C81421 /* DetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E71DEA9829C3EF2000C81421 /* DetailView.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + E71DEA7329C2CDA000C81421 /* SwiftUIMemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftUIMemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + E71DEA7629C2CDA000C81421 /* SwiftUIMemoApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUIMemoApp.swift; sourceTree = ""; }; + E71DEA7A29C2CDA200C81421 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + E71DEA7D29C2CDA200C81421 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + E71DEA7F29C2CDA200C81421 /* Persistence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Persistence.swift; sourceTree = ""; }; + E71DEA8229C2CDA200C81421 /* SwiftUIMemo.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = SwiftUIMemo.xcdatamodel; sourceTree = ""; }; + E71DEA8929C2CDF300C81421 /* MainListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainListView.swift; sourceTree = ""; }; + E71DEA8D29C2CE9B00C81421 /* Memo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Memo.swift; sourceTree = ""; }; + E71DEA8F29C2CF8C00C81421 /* MemoStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoStore.swift; sourceTree = ""; }; + E71DEA9429C3088400C81421 /* MemoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MemoCell.swift; sourceTree = ""; }; + E71DEA9629C308F400C81421 /* ComposeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeView.swift; sourceTree = ""; }; + E71DEA9829C3EF2000C81421 /* DetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailView.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + E71DEA7029C2CDA000C81421 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + E71DEA6A29C2CDA000C81421 = { + isa = PBXGroup; + children = ( + E71DEA7529C2CDA000C81421 /* SwiftUIMemo */, + E71DEA7429C2CDA000C81421 /* Products */, + ); + sourceTree = ""; + }; + E71DEA7429C2CDA000C81421 /* Products */ = { + isa = PBXGroup; + children = ( + E71DEA7329C2CDA000C81421 /* SwiftUIMemo.app */, + ); + name = Products; + sourceTree = ""; + }; + E71DEA7529C2CDA000C81421 /* SwiftUIMemo */ = { + isa = PBXGroup; + children = ( + E71DEA9129C3085B00C81421 /* View */, + E71DEA8C29C2CE4400C81421 /* Memory */, + E71DEA8B29C2CE3B00C81421 /* CoreData */, + E71DEA7629C2CDA000C81421 /* SwiftUIMemoApp.swift */, + E71DEA7A29C2CDA200C81421 /* Assets.xcassets */, + E71DEA7C29C2CDA200C81421 /* Preview Content */, + ); + path = SwiftUIMemo; + sourceTree = ""; + }; + E71DEA7C29C2CDA200C81421 /* Preview Content */ = { + isa = PBXGroup; + children = ( + E71DEA7D29C2CDA200C81421 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + E71DEA8B29C2CE3B00C81421 /* CoreData */ = { + isa = PBXGroup; + children = ( + E71DEA7F29C2CDA200C81421 /* Persistence.swift */, + E71DEA8129C2CDA200C81421 /* SwiftUIMemo.xcdatamodeld */, + ); + path = CoreData; + sourceTree = ""; + }; + E71DEA8C29C2CE4400C81421 /* Memory */ = { + isa = PBXGroup; + children = ( + E71DEA8D29C2CE9B00C81421 /* Memo.swift */, + E71DEA8F29C2CF8C00C81421 /* MemoStore.swift */, + ); + path = Memory; + sourceTree = ""; + }; + E71DEA9129C3085B00C81421 /* View */ = { + isa = PBXGroup; + children = ( + E71DEA8929C2CDF300C81421 /* MainListView.swift */, + E71DEA9429C3088400C81421 /* MemoCell.swift */, + E71DEA9629C308F400C81421 /* ComposeView.swift */, + E71DEA9829C3EF2000C81421 /* DetailView.swift */, + ); + path = View; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + E71DEA7229C2CDA000C81421 /* SwiftUIMemo */ = { + isa = PBXNativeTarget; + buildConfigurationList = E71DEA8629C2CDA300C81421 /* Build configuration list for PBXNativeTarget "SwiftUIMemo" */; + buildPhases = ( + E71DEA6F29C2CDA000C81421 /* Sources */, + E71DEA7029C2CDA000C81421 /* Frameworks */, + E71DEA7129C2CDA000C81421 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SwiftUIMemo; + productName = SwiftUIMemo; + productReference = E71DEA7329C2CDA000C81421 /* SwiftUIMemo.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + E71DEA6B29C2CDA000C81421 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1420; + LastUpgradeCheck = 1420; + TargetAttributes = { + E71DEA7229C2CDA000C81421 = { + CreatedOnToolsVersion = 14.2; + }; + }; + }; + buildConfigurationList = E71DEA6E29C2CDA000C81421 /* Build configuration list for PBXProject "SwiftUIMemo" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = E71DEA6A29C2CDA000C81421; + productRefGroup = E71DEA7429C2CDA000C81421 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + E71DEA7229C2CDA000C81421 /* SwiftUIMemo */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + E71DEA7129C2CDA000C81421 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E71DEA7E29C2CDA200C81421 /* Preview Assets.xcassets in Resources */, + E71DEA7B29C2CDA200C81421 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + E71DEA6F29C2CDA000C81421 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E71DEA9529C3088400C81421 /* MemoCell.swift in Sources */, + E71DEA9929C3EF2000C81421 /* DetailView.swift in Sources */, + E71DEA8029C2CDA200C81421 /* Persistence.swift in Sources */, + E71DEA9029C2CF8C00C81421 /* MemoStore.swift in Sources */, + E71DEA8A29C2CDF300C81421 /* MainListView.swift in Sources */, + E71DEA8329C2CDA300C81421 /* SwiftUIMemo.xcdatamodeld in Sources */, + E71DEA9729C308F400C81421 /* ComposeView.swift in Sources */, + E71DEA7729C2CDA000C81421 /* SwiftUIMemoApp.swift in Sources */, + E71DEA8E29C2CE9B00C81421 /* Memo.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + E71DEA8429C2CDA300C81421 /* 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++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; + 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 = 16.2; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + E71DEA8529C2CDA300C81421 /* 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++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; + 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 = 16.2; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + E71DEA8729C2CDA300C81421 /* 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 = "\"SwiftUIMemo/Preview Content\""; + DEVELOPMENT_TEAM = AFS6YUQ2Y4; + 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 = damin.SwiftUIMemo; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + E71DEA8829C2CDA300C81421 /* 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 = "\"SwiftUIMemo/Preview Content\""; + DEVELOPMENT_TEAM = AFS6YUQ2Y4; + 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 = damin.SwiftUIMemo; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + E71DEA6E29C2CDA000C81421 /* Build configuration list for PBXProject "SwiftUIMemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E71DEA8429C2CDA300C81421 /* Debug */, + E71DEA8529C2CDA300C81421 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E71DEA8629C2CDA300C81421 /* Build configuration list for PBXNativeTarget "SwiftUIMemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E71DEA8729C2CDA300C81421 /* Debug */, + E71DEA8829C2CDA300C81421 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCVersionGroup section */ + E71DEA8129C2CDA200C81421 /* SwiftUIMemo.xcdatamodeld */ = { + isa = XCVersionGroup; + children = ( + E71DEA8229C2CDA200C81421 /* SwiftUIMemo.xcdatamodel */, + ); + currentVersion = E71DEA8229C2CDA200C81421 /* SwiftUIMemo.xcdatamodel */; + path = SwiftUIMemo.xcdatamodeld; + sourceTree = ""; + versionGroupType = wrapper.xcdatamodel; + }; +/* End XCVersionGroup section */ + }; + rootObject = E71DEA6B29C2CDA000C81421 /* Project object */; +} diff --git a/SwiftUIMemo/SwiftUIMemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/SwiftUIMemo/SwiftUIMemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/SwiftUIMemo/SwiftUIMemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/SwiftUIMemo/SwiftUIMemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/SwiftUIMemo/SwiftUIMemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/SwiftUIMemo/SwiftUIMemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/SwiftUIMemo/SwiftUIMemo.xcodeproj/xcshareddata/xcschemes/SwiftUIMemo.xcscheme b/SwiftUIMemo/SwiftUIMemo.xcodeproj/xcshareddata/xcschemes/SwiftUIMemo.xcscheme new file mode 100644 index 0000000..8017b28 --- /dev/null +++ b/SwiftUIMemo/SwiftUIMemo.xcodeproj/xcshareddata/xcschemes/SwiftUIMemo.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SwiftUIMemo/SwiftUIMemo/Assets.xcassets/AccentColor.colorset/Contents.json b/SwiftUIMemo/SwiftUIMemo/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/SwiftUIMemo/SwiftUIMemo/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SwiftUIMemo/SwiftUIMemo/Assets.xcassets/AppIcon.appiconset/Contents.json b/SwiftUIMemo/SwiftUIMemo/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..13613e3 --- /dev/null +++ b/SwiftUIMemo/SwiftUIMemo/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/SwiftUIMemo/SwiftUIMemo/Assets.xcassets/Contents.json b/SwiftUIMemo/SwiftUIMemo/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/SwiftUIMemo/SwiftUIMemo/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SwiftUIMemo/SwiftUIMemo/CoreData/Persistence.swift b/SwiftUIMemo/SwiftUIMemo/CoreData/Persistence.swift new file mode 100644 index 0000000..31fad65 --- /dev/null +++ b/SwiftUIMemo/SwiftUIMemo/CoreData/Persistence.swift @@ -0,0 +1,56 @@ +// +// Persistence.swift +// SwiftUIMemo +// +// Created by 김담인 on 2023/03/16. +// + +import CoreData + +struct PersistenceController { + static let shared = PersistenceController() + + static var preview: PersistenceController = { + let result = PersistenceController(inMemory: true) + let viewContext = result.container.viewContext + for _ in 0..<10 { + let newItem = Item(context: viewContext) + newItem.timestamp = Date() + } + do { + try viewContext.save() + } catch { + // Replace this implementation with code to handle the error appropriately. + // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + let nsError = error as NSError + fatalError("Unresolved error \(nsError), \(nsError.userInfo)") + } + return result + }() + + let container: NSPersistentContainer + + init(inMemory: Bool = false) { + container = NSPersistentContainer(name: "SwiftUIMemo") + if inMemory { + container.persistentStoreDescriptions.first!.url = URL(fileURLWithPath: "/dev/null") + } + container.loadPersistentStores(completionHandler: { (storeDescription, error) in + if let error = error as NSError? { + // Replace this implementation with code to handle the error appropriately. + // fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + + /* + Typical reasons for an error here include: + * The parent directory does not exist, cannot be created, or disallows writing. + * The persistent store is not accessible, due to permissions or data protection when the device is locked. + * The device is out of space. + * The store could not be migrated to the current model version. + Check the error message to determine what the actual problem was. + */ + fatalError("Unresolved error \(error), \(error.userInfo)") + } + }) + container.viewContext.automaticallyMergesChangesFromParent = true + } +} diff --git a/SwiftUIMemo/SwiftUIMemo/CoreData/SwiftUIMemo.xcdatamodeld/.xccurrentversion b/SwiftUIMemo/SwiftUIMemo/CoreData/SwiftUIMemo.xcdatamodeld/.xccurrentversion new file mode 100644 index 0000000..038ea22 --- /dev/null +++ b/SwiftUIMemo/SwiftUIMemo/CoreData/SwiftUIMemo.xcdatamodeld/.xccurrentversion @@ -0,0 +1,8 @@ + + + + + _XCCurrentVersionName + SwiftUIMemo.xcdatamodel + + diff --git a/SwiftUIMemo/SwiftUIMemo/CoreData/SwiftUIMemo.xcdatamodeld/SwiftUIMemo.xcdatamodel/contents b/SwiftUIMemo/SwiftUIMemo/CoreData/SwiftUIMemo.xcdatamodeld/SwiftUIMemo.xcdatamodel/contents new file mode 100644 index 0000000..9ed2921 --- /dev/null +++ b/SwiftUIMemo/SwiftUIMemo/CoreData/SwiftUIMemo.xcdatamodeld/SwiftUIMemo.xcdatamodel/contents @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/SwiftUIMemo/SwiftUIMemo/Memory/Memo.swift b/SwiftUIMemo/SwiftUIMemo/Memory/Memo.swift new file mode 100644 index 0000000..7eceea2 --- /dev/null +++ b/SwiftUIMemo/SwiftUIMemo/Memory/Memo.swift @@ -0,0 +1,21 @@ +// +// Memo.swift +// SwiftUIMemo +// +// Created by 김담인 on 2023/03/16. +// + +import Foundation +import SwiftUI + +class Memo: Identifiable, ObservableObject { + let id: UUID + @Published var content: String + let insertDate: Date + + init(content: String, insertDate: Date = Date.now) { + id = UUID() + self.content = content + self.insertDate = insertDate + } +} diff --git a/SwiftUIMemo/SwiftUIMemo/Memory/MemoStore.swift b/SwiftUIMemo/SwiftUIMemo/Memory/MemoStore.swift new file mode 100644 index 0000000..4c721aa --- /dev/null +++ b/SwiftUIMemo/SwiftUIMemo/Memory/MemoStore.swift @@ -0,0 +1,42 @@ +// +// MemoStore.swift +// SwiftUIMemo +// +// Created by 김담인 on 2023/03/16. +// + +import Foundation + +class MemoStore: ObservableObject { + // published로 설정하면 배열을 업데이트 할때 배열에 바인딩 되어있는 뷰도 자동으로 업데이트 됨 + @Published var list: [Memo] + + init() { + list = [ + Memo(content: "Hello", insertDate: Date.now), + Memo(content: "Awesome", insertDate: Date.now.addingTimeInterval(3600 * -24)), + Memo(content: "SwiftUI", insertDate: Date.now.addingTimeInterval(3600 * -48)), + ] + } + + func insert(memo: String) { + list.insert(Memo(content: memo), at: 0) + } + + func update(memo: Memo?, content: String) { + guard let memo = memo else { + return + } + memo.content = content + } + + func delete(memo: Memo) { + list.removeAll { $0.id == memo.id } + } + + func delete(set: IndexSet) { + for index in set { + list.remove(at: index) + } + } +} diff --git a/SwiftUIMemo/SwiftUIMemo/Preview Content/Preview Assets.xcassets/Contents.json b/SwiftUIMemo/SwiftUIMemo/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/SwiftUIMemo/SwiftUIMemo/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SwiftUIMemo/SwiftUIMemo/SwiftUIMemoApp.swift b/SwiftUIMemo/SwiftUIMemo/SwiftUIMemoApp.swift new file mode 100644 index 0000000..f7587ce --- /dev/null +++ b/SwiftUIMemo/SwiftUIMemo/SwiftUIMemoApp.swift @@ -0,0 +1,22 @@ +// +// SwiftUIMemoApp.swift +// SwiftUIMemo +// +// Created by 김담인 on 2023/03/16. +// + +import SwiftUI + +@main +struct SwiftUIMemoApp: App { + @State var store = MemoStore() + let persistenceController = PersistenceController.shared + + var body: some Scene { + WindowGroup { + MainListView() + .environment(\.managedObjectContext, persistenceController.container.viewContext) + .environmentObject(store) + } + } +} diff --git a/SwiftUIMemo/SwiftUIMemo/View/ComposeView.swift b/SwiftUIMemo/SwiftUIMemo/View/ComposeView.swift new file mode 100644 index 0000000..5f3b44c --- /dev/null +++ b/SwiftUIMemo/SwiftUIMemo/View/ComposeView.swift @@ -0,0 +1,66 @@ +// +// ComposeView.swift +// SwiftUIMemo +// +// Created by 김담인 on 2023/03/16. +// + +import SwiftUI + +struct ComposeView: View { + @EnvironmentObject var store: MemoStore + + var memo: Memo? = nil + + @Environment(\.dismiss) var dismiss + + @State private var content: String = "" + + var body: some View { + NavigationView { + VStack { + // content가 변경되면 그게 editor에 기록되고, eiditor에 text가 들어오면 content에 저장됨 + // 둘다 서로 바인딩 되어있어 two-way 바인딩 + TextEditor(text: $content) + .padding() + .onAppear() { + if let memo = memo { + content = memo.content + } + } + } + .navigationTitle(memo != nil ? "메모 편집" : "새 메모") + .navigationBarTitleDisplayMode(.inline) + .toolbar { + ToolbarItemGroup(placement: .navigationBarLeading) { + Button { + dismiss() + } label: { + Text("취소") + } + } + + ToolbarItemGroup(placement: .navigationBarTrailing) { + Button { + if let memo = memo { + store.update(memo: memo, content: content) + } else { + store.insert(memo: content) + } + dismiss() + } label: { + Text("저장") + } + } + } + } + } +} + +struct ComposeView_Previews: PreviewProvider { + static var previews: some View { + ComposeView() + .environmentObject(MemoStore()) + } +} + diff --git a/SwiftUIMemo/SwiftUIMemo/View/DetailView.swift b/SwiftUIMemo/SwiftUIMemo/View/DetailView.swift new file mode 100644 index 0000000..9d6902e --- /dev/null +++ b/SwiftUIMemo/SwiftUIMemo/View/DetailView.swift @@ -0,0 +1,82 @@ +// +// DetailView.swift +// SwiftUIMemo +// +// Created by 김담인 on 2023/03/17. +// + +import SwiftUI + +struct DetailView: View { + //Memo에 Published로 설정한 속성이 바뀌면 뷰도 바뀜 + @ObservedObject var memo: Memo + + @EnvironmentObject var store: MemoStore + + @State private var showCompoesr: Bool = false + @State private var showDeleteAlert: Bool = false + + @Environment(\.dismiss) var dismiss + + var body: some View { + // NavigationView로 .toolbar를 감싸야함! + NavigationView { + VStack { + ScrollView { + VStack { + Text(memo.insertDate, style: .date) + .padding() + .font(.footnote) + .foregroundColor(.secondary) + HStack { + Text(memo.content) + .padding() + Spacer(minLength: 0) + } + } + } + + } + .toolbar { + ToolbarItemGroup(placement: .bottomBar) { + Button { + showDeleteAlert = true + } label: { + Image(systemName: "trash") + } + .foregroundColor(.red) + .alert("삭제 확인", isPresented: $showDeleteAlert) { + Button(role: .destructive) { + store.delete(memo: memo) + dismiss() + } label: { + Text("삭제") + } + } message: { + Text("메모를 삭제할까요?") + } + + Button { + showCompoesr = true + } label: { + Image(systemName: "square.and.pencil") + } + } + } + } + .navigationTitle("메모 보기") + .navigationBarTitleDisplayMode(.inline) + .sheet(isPresented: $showCompoesr) { + ComposeView(memo: memo) + } + } +} + +struct DetailView_Previews: PreviewProvider { + static var previews: some View { + NavigationView { + DetailView(memo: Memo(content: "Hello")) + .environmentObject(MemoStore()) + } + } +} diff --git a/SwiftUIMemo/SwiftUIMemo/View/MainListView.swift b/SwiftUIMemo/SwiftUIMemo/View/MainListView.swift new file mode 100644 index 0000000..7bb25f4 --- /dev/null +++ b/SwiftUIMemo/SwiftUIMemo/View/MainListView.swift @@ -0,0 +1,53 @@ +// +// MainListView.swift +// SwiftUIMemo +// +// Created by 김담인 on 2023/03/16. +// + +import SwiftUI + +struct MainListView: View { + @EnvironmentObject var store: MemoStore + + @State private var showComposer: Bool = false + + var body: some View { + NavigationView { + List { + ForEach(store.list) { memo in + NavigationLink { + DetailView(memo: memo) + } label: { + MemoCell(memo: memo) + } + } + .onDelete(perform: store.delete) + } + .listStyle(.automatic) + .navigationTitle("내 메모") + .toolbar { + Button { + showComposer = true + } label: { + Image(systemName: "plus") + } + } + // showComposer가 트루로 바뀌면 모달방식으로 ComposeView를 띄워줌 + .sheet(isPresented: $showComposer) { + ComposeView() + } + + } + //요거 없으면 DetailView에서 툴바 아이콘이 표시가 안됨 +// .navigationViewStyle(.stack) + } +} + +struct MainListView_Previews: PreviewProvider { + static var previews: some View { + MainListView() + .environmentObject(MemoStore()) + } +} + diff --git a/SwiftUIMemo/SwiftUIMemo/View/MemoCell.swift b/SwiftUIMemo/SwiftUIMemo/View/MemoCell.swift new file mode 100644 index 0000000..4e4e8d8 --- /dev/null +++ b/SwiftUIMemo/SwiftUIMemo/View/MemoCell.swift @@ -0,0 +1,29 @@ +// +// MemoCell.swift +// SwiftUIMemo +// +// Created by 김담인 on 2023/03/16. +// + +import SwiftUI + +struct MemoCell: View { + @ObservedObject var memo: Memo + var body: some View { + VStack(alignment: .leading) { + Text(memo.content) + .font(.body) + .lineLimit(1) + Text(memo.insertDate, style: .date) + .font(.caption) + .foregroundColor(.secondary) + } + } +} + + +struct MemoCell_Previews: PreviewProvider { + static var previews: some View { + MemoCell(memo: Memo(content: "Test")) + } +}