From 8caff6867b8c7a55454bb41f24f34dffa62512ac Mon Sep 17 00:00:00 2001 From: fummicc1 Date: Thu, 21 Apr 2022 22:41:41 +0900 Subject: [PATCH 1/2] Start creating example app `MessageApp` --- .../project.pbxproj | 4 +- .../MessageApp.xcodeproj/project.pbxproj | 455 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 143 ++++++ .../Shared/Assets.xcassets/Contents.json | 6 + .../MessageApp/Shared/ContentView.swift | 21 + .../MessageApp/Shared/MessageAppApp.swift | 17 + .../MessageApp/macOS/macOS.entitlements | 10 + 10 files changed, 680 insertions(+), 2 deletions(-) create mode 100644 Examples/Practical/MessageApp/MessageApp.xcodeproj/project.pbxproj create mode 100644 Examples/Practical/MessageApp/MessageApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 Examples/Practical/MessageApp/MessageApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 Examples/Practical/MessageApp/Shared/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 Examples/Practical/MessageApp/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 Examples/Practical/MessageApp/Shared/Assets.xcassets/Contents.json create mode 100644 Examples/Practical/MessageApp/Shared/ContentView.swift create mode 100644 Examples/Practical/MessageApp/Shared/MessageAppApp.swift create mode 100644 Examples/Practical/MessageApp/macOS/macOS.entitlements diff --git a/Examples/Practical/BoardApplication/BoardApplication.xcodeproj/project.pbxproj b/Examples/Practical/BoardApplication/BoardApplication.xcodeproj/project.pbxproj index 023a59d..a187bec 100644 --- a/Examples/Practical/BoardApplication/BoardApplication.xcodeproj/project.pbxproj +++ b/Examples/Practical/BoardApplication/BoardApplication.xcodeproj/project.pbxproj @@ -289,7 +289,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"BoardApplication/Preview Content\""; - DEVELOPMENT_TEAM = 2X6AD4W323; + DEVELOPMENT_TEAM = S8WBNKMKYU; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; @@ -319,7 +319,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"BoardApplication/Preview Content\""; - DEVELOPMENT_TEAM = 2X6AD4W323; + DEVELOPMENT_TEAM = S8WBNKMKYU; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; diff --git a/Examples/Practical/MessageApp/MessageApp.xcodeproj/project.pbxproj b/Examples/Practical/MessageApp/MessageApp.xcodeproj/project.pbxproj new file mode 100644 index 0000000..cf7a515 --- /dev/null +++ b/Examples/Practical/MessageApp/MessageApp.xcodeproj/project.pbxproj @@ -0,0 +1,455 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 55; + objects = { + +/* Begin PBXBuildFile section */ + D37C5D33281195AF004E77C2 /* MessageAppApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = D37C5D23281195AE004E77C2 /* MessageAppApp.swift */; }; + D37C5D34281195AF004E77C2 /* MessageAppApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = D37C5D23281195AE004E77C2 /* MessageAppApp.swift */; }; + D37C5D35281195AF004E77C2 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D37C5D24281195AE004E77C2 /* ContentView.swift */; }; + D37C5D36281195AF004E77C2 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D37C5D24281195AE004E77C2 /* ContentView.swift */; }; + D37C5D37281195AF004E77C2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D37C5D25281195AF004E77C2 /* Assets.xcassets */; }; + D37C5D38281195AF004E77C2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D37C5D25281195AF004E77C2 /* Assets.xcassets */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + D37C5D23281195AE004E77C2 /* MessageAppApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageAppApp.swift; sourceTree = ""; }; + D37C5D24281195AE004E77C2 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + D37C5D25281195AF004E77C2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + D37C5D2A281195AF004E77C2 /* MessageApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MessageApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + D37C5D30281195AF004E77C2 /* MessageApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MessageApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + D37C5D32281195AF004E77C2 /* macOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = macOS.entitlements; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + D37C5D27281195AF004E77C2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D37C5D2D281195AF004E77C2 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + D37C5D1D281195AE004E77C2 = { + isa = PBXGroup; + children = ( + D37C5D22281195AE004E77C2 /* Shared */, + D37C5D31281195AF004E77C2 /* macOS */, + D37C5D2B281195AF004E77C2 /* Products */, + ); + sourceTree = ""; + }; + D37C5D22281195AE004E77C2 /* Shared */ = { + isa = PBXGroup; + children = ( + D37C5D23281195AE004E77C2 /* MessageAppApp.swift */, + D37C5D24281195AE004E77C2 /* ContentView.swift */, + D37C5D25281195AF004E77C2 /* Assets.xcassets */, + ); + path = Shared; + sourceTree = ""; + }; + D37C5D2B281195AF004E77C2 /* Products */ = { + isa = PBXGroup; + children = ( + D37C5D2A281195AF004E77C2 /* MessageApp.app */, + D37C5D30281195AF004E77C2 /* MessageApp.app */, + ); + name = Products; + sourceTree = ""; + }; + D37C5D31281195AF004E77C2 /* macOS */ = { + isa = PBXGroup; + children = ( + D37C5D32281195AF004E77C2 /* macOS.entitlements */, + ); + path = macOS; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + D37C5D29281195AF004E77C2 /* MessageApp (iOS) */ = { + isa = PBXNativeTarget; + buildConfigurationList = D37C5D3B281195AF004E77C2 /* Build configuration list for PBXNativeTarget "MessageApp (iOS)" */; + buildPhases = ( + D37C5D26281195AF004E77C2 /* Sources */, + D37C5D27281195AF004E77C2 /* Frameworks */, + D37C5D28281195AF004E77C2 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "MessageApp (iOS)"; + productName = "MessageApp (iOS)"; + productReference = D37C5D2A281195AF004E77C2 /* MessageApp.app */; + productType = "com.apple.product-type.application"; + }; + D37C5D2F281195AF004E77C2 /* MessageApp (macOS) */ = { + isa = PBXNativeTarget; + buildConfigurationList = D37C5D3E281195AF004E77C2 /* Build configuration list for PBXNativeTarget "MessageApp (macOS)" */; + buildPhases = ( + D37C5D2C281195AF004E77C2 /* Sources */, + D37C5D2D281195AF004E77C2 /* Frameworks */, + D37C5D2E281195AF004E77C2 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "MessageApp (macOS)"; + productName = "MessageApp (macOS)"; + productReference = D37C5D30281195AF004E77C2 /* MessageApp.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + D37C5D1E281195AE004E77C2 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1330; + LastUpgradeCheck = 1330; + TargetAttributes = { + D37C5D29281195AF004E77C2 = { + CreatedOnToolsVersion = 13.3.1; + }; + D37C5D2F281195AF004E77C2 = { + CreatedOnToolsVersion = 13.3.1; + }; + }; + }; + buildConfigurationList = D37C5D21281195AE004E77C2 /* Build configuration list for PBXProject "MessageApp" */; + compatibilityVersion = "Xcode 13.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = D37C5D1D281195AE004E77C2; + productRefGroup = D37C5D2B281195AF004E77C2 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + D37C5D29281195AF004E77C2 /* MessageApp (iOS) */, + D37C5D2F281195AF004E77C2 /* MessageApp (macOS) */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + D37C5D28281195AF004E77C2 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D37C5D37281195AF004E77C2 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D37C5D2E281195AF004E77C2 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D37C5D38281195AF004E77C2 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + D37C5D26281195AF004E77C2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D37C5D35281195AF004E77C2 /* ContentView.swift in Sources */, + D37C5D33281195AF004E77C2 /* MessageAppApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D37C5D2C281195AF004E77C2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D37C5D36281195AF004E77C2 /* ContentView.swift in Sources */, + D37C5D34281195AF004E77C2 /* MessageAppApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + D37C5D39281195AF004E77C2 /* 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++17"; + 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; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + D37C5D3A281195AF004E77C2 /* 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++17"; + 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; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + D37C5D3C281195AF004E77C2 /* 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_TEAM = S8WBNKMKYU; + 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"; + IPHONEOS_DEPLOYMENT_TARGET = 15.4; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = dev.fummicc1.EasyFirebaseSwift.Example.MessageApp; + PRODUCT_NAME = MessageApp; + SDKROOT = iphoneos; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + D37C5D3D281195AF004E77C2 /* 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_TEAM = S8WBNKMKYU; + 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"; + IPHONEOS_DEPLOYMENT_TARGET = 15.4; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = dev.fummicc1.EasyFirebaseSwift.Example.MessageApp; + PRODUCT_NAME = MessageApp; + SDKROOT = iphoneos; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + D37C5D3F281195AF004E77C2 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = macOS/macOS.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = S8WBNKMKYU; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 12.2; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = dev.fummicc1.EasyFirebaseSwift.Example.MessageApp; + PRODUCT_NAME = MessageApp; + SDKROOT = macosx; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + D37C5D40281195AF004E77C2 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = macOS/macOS.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = S8WBNKMKYU; + ENABLE_HARDENED_RUNTIME = YES; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 12.2; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = dev.fummicc1.EasyFirebaseSwift.Example.MessageApp; + PRODUCT_NAME = MessageApp; + SDKROOT = macosx; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + D37C5D21281195AE004E77C2 /* Build configuration list for PBXProject "MessageApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D37C5D39281195AF004E77C2 /* Debug */, + D37C5D3A281195AF004E77C2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + D37C5D3B281195AF004E77C2 /* Build configuration list for PBXNativeTarget "MessageApp (iOS)" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D37C5D3C281195AF004E77C2 /* Debug */, + D37C5D3D281195AF004E77C2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + D37C5D3E281195AF004E77C2 /* Build configuration list for PBXNativeTarget "MessageApp (macOS)" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D37C5D3F281195AF004E77C2 /* Debug */, + D37C5D40281195AF004E77C2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = D37C5D1E281195AE004E77C2 /* Project object */; +} diff --git a/Examples/Practical/MessageApp/MessageApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Examples/Practical/MessageApp/MessageApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Examples/Practical/MessageApp/MessageApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Examples/Practical/MessageApp/MessageApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Examples/Practical/MessageApp/MessageApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Examples/Practical/MessageApp/MessageApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Examples/Practical/MessageApp/Shared/Assets.xcassets/AccentColor.colorset/Contents.json b/Examples/Practical/MessageApp/Shared/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/Examples/Practical/MessageApp/Shared/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Practical/MessageApp/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json b/Examples/Practical/MessageApp/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..63efdb0 --- /dev/null +++ b/Examples/Practical/MessageApp/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,143 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Practical/MessageApp/Shared/Assets.xcassets/Contents.json b/Examples/Practical/MessageApp/Shared/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Examples/Practical/MessageApp/Shared/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Examples/Practical/MessageApp/Shared/ContentView.swift b/Examples/Practical/MessageApp/Shared/ContentView.swift new file mode 100644 index 0000000..8806020 --- /dev/null +++ b/Examples/Practical/MessageApp/Shared/ContentView.swift @@ -0,0 +1,21 @@ +// +// ContentView.swift +// Shared +// +// Created by Fumiya Tanaka on 2022/04/21. +// + +import SwiftUI + +struct ContentView: View { + var body: some View { + Text("Hello, world!") + .padding() + } +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } +} diff --git a/Examples/Practical/MessageApp/Shared/MessageAppApp.swift b/Examples/Practical/MessageApp/Shared/MessageAppApp.swift new file mode 100644 index 0000000..d03dc93 --- /dev/null +++ b/Examples/Practical/MessageApp/Shared/MessageAppApp.swift @@ -0,0 +1,17 @@ +// +// MessageAppApp.swift +// Shared +// +// Created by Fumiya Tanaka on 2022/04/21. +// + +import SwiftUI + +@main +struct MessageAppApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/Examples/Practical/MessageApp/macOS/macOS.entitlements b/Examples/Practical/MessageApp/macOS/macOS.entitlements new file mode 100644 index 0000000..f2ef3ae --- /dev/null +++ b/Examples/Practical/MessageApp/macOS/macOS.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + From 6f310f348710aefd7078d5a8d1fadd3d8c5a2976 Mon Sep 17 00:00:00 2001 From: fummicc1 Date: Thu, 21 Apr 2022 23:38:12 +0900 Subject: [PATCH 2/2] WIP: Implement `Repository` --- .../MessageApp.xcodeproj/project.pbxproj | 105 ++++++++++-- .../Shared/GoogleService-Info.plist | 34 ++++ .../Practical/MessageApp/Shared/Message.swift | 33 ++++ .../MessageApp/Shared/MessageApp.swift | 27 ++++ .../MessageApp/Shared/MessageAppApp.swift | 17 -- .../Shared/Pages/MessageListModel.swift | 46 ++++++ .../Shared/Pages/MessageListView.swift | 23 +++ .../MessageApp/Shared/Repository.swift | 152 ++++++++++++++++++ .../{ContentView.swift => RootView.swift} | 9 +- 9 files changed, 414 insertions(+), 32 deletions(-) create mode 100644 Examples/Practical/MessageApp/Shared/GoogleService-Info.plist create mode 100644 Examples/Practical/MessageApp/Shared/Message.swift create mode 100644 Examples/Practical/MessageApp/Shared/MessageApp.swift delete mode 100644 Examples/Practical/MessageApp/Shared/MessageAppApp.swift create mode 100644 Examples/Practical/MessageApp/Shared/Pages/MessageListModel.swift create mode 100644 Examples/Practical/MessageApp/Shared/Pages/MessageListView.swift create mode 100644 Examples/Practical/MessageApp/Shared/Repository.swift rename Examples/Practical/MessageApp/Shared/{ContentView.swift => RootView.swift} (68%) diff --git a/Examples/Practical/MessageApp/MessageApp.xcodeproj/project.pbxproj b/Examples/Practical/MessageApp/MessageApp.xcodeproj/project.pbxproj index cf7a515..99c9932 100644 --- a/Examples/Practical/MessageApp/MessageApp.xcodeproj/project.pbxproj +++ b/Examples/Practical/MessageApp/MessageApp.xcodeproj/project.pbxproj @@ -7,21 +7,39 @@ objects = { /* Begin PBXBuildFile section */ - D37C5D33281195AF004E77C2 /* MessageAppApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = D37C5D23281195AE004E77C2 /* MessageAppApp.swift */; }; - D37C5D34281195AF004E77C2 /* MessageAppApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = D37C5D23281195AE004E77C2 /* MessageAppApp.swift */; }; - D37C5D35281195AF004E77C2 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D37C5D24281195AE004E77C2 /* ContentView.swift */; }; - D37C5D36281195AF004E77C2 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D37C5D24281195AE004E77C2 /* ContentView.swift */; }; + D37C5D33281195AF004E77C2 /* MessageApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = D37C5D23281195AE004E77C2 /* MessageApp.swift */; }; + D37C5D34281195AF004E77C2 /* MessageApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = D37C5D23281195AE004E77C2 /* MessageApp.swift */; }; + D37C5D35281195AF004E77C2 /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D37C5D24281195AE004E77C2 /* RootView.swift */; }; + D37C5D36281195AF004E77C2 /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D37C5D24281195AE004E77C2 /* RootView.swift */; }; D37C5D37281195AF004E77C2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D37C5D25281195AF004E77C2 /* Assets.xcassets */; }; D37C5D38281195AF004E77C2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D37C5D25281195AF004E77C2 /* Assets.xcassets */; }; + D39C66742811971500340606 /* EasyFirebaseSwiftAuth in Frameworks */ = {isa = PBXBuildFile; productRef = D39C66732811971500340606 /* EasyFirebaseSwiftAuth */; }; + D39C66762811971500340606 /* EasyFirebaseSwiftFirestore in Frameworks */ = {isa = PBXBuildFile; productRef = D39C66752811971500340606 /* EasyFirebaseSwiftFirestore */; }; + D39C66782811971500340606 /* EasyFirebaseSwiftStorage in Frameworks */ = {isa = PBXBuildFile; productRef = D39C66772811971500340606 /* EasyFirebaseSwiftStorage */; }; + D39C667A2811972900340606 /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = D39C66792811972900340606 /* Message.swift */; }; + D39C667B2811972900340606 /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = D39C66792811972900340606 /* Message.swift */; }; + D39C667D2811975000340606 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = D39C667C2811975000340606 /* GoogleService-Info.plist */; }; + D39C667E2811975000340606 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = D39C667C2811975000340606 /* GoogleService-Info.plist */; }; + D39C66802811986600340606 /* Repository.swift in Sources */ = {isa = PBXBuildFile; fileRef = D39C667F2811986600340606 /* Repository.swift */; }; + D39C66812811986600340606 /* Repository.swift in Sources */ = {isa = PBXBuildFile; fileRef = D39C667F2811986600340606 /* Repository.swift */; }; + D39C66832811A14A00340606 /* MessageListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D39C66822811A14A00340606 /* MessageListView.swift */; }; + D39C66842811A14A00340606 /* MessageListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D39C66822811A14A00340606 /* MessageListView.swift */; }; + D39C66872811A18300340606 /* MessageListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D39C66862811A18300340606 /* MessageListModel.swift */; }; + D39C66882811A18300340606 /* MessageListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D39C66862811A18300340606 /* MessageListModel.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - D37C5D23281195AE004E77C2 /* MessageAppApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageAppApp.swift; sourceTree = ""; }; - D37C5D24281195AE004E77C2 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + D37C5D23281195AE004E77C2 /* MessageApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageApp.swift; sourceTree = ""; }; + D37C5D24281195AE004E77C2 /* RootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootView.swift; sourceTree = ""; }; D37C5D25281195AF004E77C2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; D37C5D2A281195AF004E77C2 /* MessageApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MessageApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; D37C5D30281195AF004E77C2 /* MessageApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MessageApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; D37C5D32281195AF004E77C2 /* macOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = macOS.entitlements; sourceTree = ""; }; + D39C66792811972900340606 /* Message.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Message.swift; sourceTree = ""; }; + D39C667C2811975000340606 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; + D39C667F2811986600340606 /* Repository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Repository.swift; sourceTree = ""; }; + D39C66822811A14A00340606 /* MessageListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageListView.swift; sourceTree = ""; }; + D39C66862811A18300340606 /* MessageListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageListModel.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -29,6 +47,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + D39C66742811971500340606 /* EasyFirebaseSwiftAuth in Frameworks */, + D39C66762811971500340606 /* EasyFirebaseSwiftFirestore in Frameworks */, + D39C66782811971500340606 /* EasyFirebaseSwiftStorage in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -54,8 +75,12 @@ D37C5D22281195AE004E77C2 /* Shared */ = { isa = PBXGroup; children = ( - D37C5D23281195AE004E77C2 /* MessageAppApp.swift */, - D37C5D24281195AE004E77C2 /* ContentView.swift */, + D39C66852811A17200340606 /* Pages */, + D39C667C2811975000340606 /* GoogleService-Info.plist */, + D39C66792811972900340606 /* Message.swift */, + D37C5D23281195AE004E77C2 /* MessageApp.swift */, + D37C5D24281195AE004E77C2 /* RootView.swift */, + D39C667F2811986600340606 /* Repository.swift */, D37C5D25281195AF004E77C2 /* Assets.xcassets */, ); path = Shared; @@ -78,6 +103,15 @@ path = macOS; sourceTree = ""; }; + D39C66852811A17200340606 /* Pages */ = { + isa = PBXGroup; + children = ( + D39C66822811A14A00340606 /* MessageListView.swift */, + D39C66862811A18300340606 /* MessageListModel.swift */, + ); + path = Pages; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -94,6 +128,11 @@ dependencies = ( ); name = "MessageApp (iOS)"; + packageProductDependencies = ( + D39C66732811971500340606 /* EasyFirebaseSwiftAuth */, + D39C66752811971500340606 /* EasyFirebaseSwiftFirestore */, + D39C66772811971500340606 /* EasyFirebaseSwiftStorage */, + ); productName = "MessageApp (iOS)"; productReference = D37C5D2A281195AF004E77C2 /* MessageApp.app */; productType = "com.apple.product-type.application"; @@ -142,6 +181,9 @@ Base, ); mainGroup = D37C5D1D281195AE004E77C2; + packageReferences = ( + D39C66722811971500340606 /* XCRemoteSwiftPackageReference "EasyFirebaseSwift" */, + ); productRefGroup = D37C5D2B281195AF004E77C2 /* Products */; projectDirPath = ""; projectRoot = ""; @@ -158,6 +200,7 @@ buildActionMask = 2147483647; files = ( D37C5D37281195AF004E77C2 /* Assets.xcassets in Resources */, + D39C667D2811975000340606 /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -166,6 +209,7 @@ buildActionMask = 2147483647; files = ( D37C5D38281195AF004E77C2 /* Assets.xcassets in Resources */, + D39C667E2811975000340606 /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -176,8 +220,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D37C5D35281195AF004E77C2 /* ContentView.swift in Sources */, - D37C5D33281195AF004E77C2 /* MessageAppApp.swift in Sources */, + D39C667A2811972900340606 /* Message.swift in Sources */, + D37C5D35281195AF004E77C2 /* RootView.swift in Sources */, + D37C5D33281195AF004E77C2 /* MessageApp.swift in Sources */, + D39C66832811A14A00340606 /* MessageListView.swift in Sources */, + D39C66802811986600340606 /* Repository.swift in Sources */, + D39C66872811A18300340606 /* MessageListModel.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -185,8 +233,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D37C5D36281195AF004E77C2 /* ContentView.swift in Sources */, - D37C5D34281195AF004E77C2 /* MessageAppApp.swift in Sources */, + D39C667B2811972900340606 /* Message.swift in Sources */, + D37C5D36281195AF004E77C2 /* RootView.swift in Sources */, + D37C5D34281195AF004E77C2 /* MessageApp.swift in Sources */, + D39C66842811A14A00340606 /* MessageListView.swift in Sources */, + D39C66812811986600340606 /* Repository.swift in Sources */, + D39C66882811A18300340606 /* MessageListModel.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -450,6 +502,35 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + D39C66722811971500340606 /* XCRemoteSwiftPackageReference "EasyFirebaseSwift" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/fummicc1/EasyFirebaseSwift"; + requirement = { + branch = main; + kind = branch; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + D39C66732811971500340606 /* EasyFirebaseSwiftAuth */ = { + isa = XCSwiftPackageProductDependency; + package = D39C66722811971500340606 /* XCRemoteSwiftPackageReference "EasyFirebaseSwift" */; + productName = EasyFirebaseSwiftAuth; + }; + D39C66752811971500340606 /* EasyFirebaseSwiftFirestore */ = { + isa = XCSwiftPackageProductDependency; + package = D39C66722811971500340606 /* XCRemoteSwiftPackageReference "EasyFirebaseSwift" */; + productName = EasyFirebaseSwiftFirestore; + }; + D39C66772811971500340606 /* EasyFirebaseSwiftStorage */ = { + isa = XCSwiftPackageProductDependency; + package = D39C66722811971500340606 /* XCRemoteSwiftPackageReference "EasyFirebaseSwift" */; + productName = EasyFirebaseSwiftStorage; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = D37C5D1E281195AE004E77C2 /* Project object */; } diff --git a/Examples/Practical/MessageApp/Shared/GoogleService-Info.plist b/Examples/Practical/MessageApp/Shared/GoogleService-Info.plist new file mode 100644 index 0000000..f9132a7 --- /dev/null +++ b/Examples/Practical/MessageApp/Shared/GoogleService-Info.plist @@ -0,0 +1,34 @@ + + + + + CLIENT_ID + 515012031387-7o4ug069j815ob817upknjuoapb5tags.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.515012031387-7o4ug069j815ob817upknjuoapb5tags + API_KEY + AIzaSyDhMV12dqdpRU_oLJRajoZKSv6XdYdqri8 + GCM_SENDER_ID + 515012031387 + PLIST_VERSION + 1 + BUNDLE_ID + dev.fummicc1.EasyFirebaseSwift.Example.MessageApp + PROJECT_ID + easyfirebaseswift-message + STORAGE_BUCKET + easyfirebaseswift-message.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:515012031387:ios:94bfaa3a37987a9d34273e + + \ No newline at end of file diff --git a/Examples/Practical/MessageApp/Shared/Message.swift b/Examples/Practical/MessageApp/Shared/Message.swift new file mode 100644 index 0000000..5837147 --- /dev/null +++ b/Examples/Practical/MessageApp/Shared/Message.swift @@ -0,0 +1,33 @@ +// +// Message.swift +// MessageApp +// +// Created by Fumiya Tanaka on 2022/04/21. +// + +import Foundation +import FirebaseFirestoreSwift +import FirebaseFirestore +import EasyFirebaseSwiftFirestore + +struct Message: FirestoreModel { + + // MARK: Protocol confirmance + static var collectionName: String = "messages" + + @DocumentID + var ref: DocumentReference? + + @ServerTimestamp + var createdAt: Timestamp? + + @ServerTimestamp + var updatedAt: Timestamp? + + // MARK: Custom Properties + var text: String + + var postedAt: Timestamp? + var senderID: String + var receiverID: String? // if nil is assigned, will be broadcast. +} diff --git a/Examples/Practical/MessageApp/Shared/MessageApp.swift b/Examples/Practical/MessageApp/Shared/MessageApp.swift new file mode 100644 index 0000000..ac2cd7c --- /dev/null +++ b/Examples/Practical/MessageApp/Shared/MessageApp.swift @@ -0,0 +1,27 @@ +// +// MessageApp.swift +// Shared +// +// Created by Fumiya Tanaka on 2022/04/21. +// + +import SwiftUI +import FirebaseCore + +@main +struct MessageApp: App { + + init() { + FirebaseApp.configure() + } + + var body: some Scene { + WindowGroup { + Group { + RootView() + .environmentObject(RepositoryImpl()) + } + .environmentObject(RepositoryImpl()) + } + } +} diff --git a/Examples/Practical/MessageApp/Shared/MessageAppApp.swift b/Examples/Practical/MessageApp/Shared/MessageAppApp.swift deleted file mode 100644 index d03dc93..0000000 --- a/Examples/Practical/MessageApp/Shared/MessageAppApp.swift +++ /dev/null @@ -1,17 +0,0 @@ -// -// MessageAppApp.swift -// Shared -// -// Created by Fumiya Tanaka on 2022/04/21. -// - -import SwiftUI - -@main -struct MessageAppApp: App { - var body: some Scene { - WindowGroup { - ContentView() - } - } -} diff --git a/Examples/Practical/MessageApp/Shared/Pages/MessageListModel.swift b/Examples/Practical/MessageApp/Shared/Pages/MessageListModel.swift new file mode 100644 index 0000000..977b323 --- /dev/null +++ b/Examples/Practical/MessageApp/Shared/Pages/MessageListModel.swift @@ -0,0 +1,46 @@ +// +// MessageListModel.swift +// MessageApp +// +// Created by Fumiya Tanaka on 2022/04/21. +// + +import Foundation +import Combine + +class MessageListModel: ObservableObject { + @Published var messages: [Message] = [] + @Published var startMessage: String? + + private var uid: String? + + private let repository: Repository + private var cancellables: Set = [] + + init(repository: Repository) { + self.repository = repository + + repository.uid.sink { uid in + self.uid = uid + }.store(in: &cancellables) + + repository.messages.assign(to: &$messages) + } + + func createBroadcastMessage() async { + guard let startMessage = startMessage, + let uid = uid else { + return + } + let message = Message( + text: startMessage, + senderID: uid, + receiverID: nil + ) + do { + try await repository.saveMessage(message) + } catch { + print(error) + } + } +} diff --git a/Examples/Practical/MessageApp/Shared/Pages/MessageListView.swift b/Examples/Practical/MessageApp/Shared/Pages/MessageListView.swift new file mode 100644 index 0000000..256e8c3 --- /dev/null +++ b/Examples/Practical/MessageApp/Shared/Pages/MessageListView.swift @@ -0,0 +1,23 @@ +// +// MessageListView.swift +// MessageApp +// +// Created by Fumiya Tanaka on 2022/04/21. +// + +import SwiftUI + +struct MessageListView: View { + + @EnvironmentObject var repository: RepositoryImpl + + var body: some View { + Text("Hello, World!") + } +} + +struct MessageListView_Previews: PreviewProvider { + static var previews: some View { + MessageListView() + } +} diff --git a/Examples/Practical/MessageApp/Shared/Repository.swift b/Examples/Practical/MessageApp/Shared/Repository.swift new file mode 100644 index 0000000..6957ed4 --- /dev/null +++ b/Examples/Practical/MessageApp/Shared/Repository.swift @@ -0,0 +1,152 @@ +// +// Repository.swift +// MessageApp +// +// Created by Fumiya Tanaka on 2022/04/21. +// + +import Foundation +import Combine +import EasyFirebaseSwiftFirestore +import EasyFirebaseSwiftStorage +import EasyFirebaseSwiftAuth + +/// `Repository` has responsibility to store and handle all of contents in this app. +protocol Repository { + + // MARK: Message + var messages: AnyPublisher<[Message], Never> { get } + + func saveMessage(_ message: Message) async throws + func fetchMessages(of userID: String) async throws -> [Message] + func deleteMessage(_ message: Message) async throws + func updateMessage(message: Message) async throws + + // MARK: Auth + var isLoggedIn: AnyPublisher { get } + func signIn() async throws + func signOut() async throws + + // MARK: User + var uid: AnyPublisher { get } + func fetchAvatar() -> AnyPublisher + func setupAvatar(of userID: String, image: Data) -> AnyPublisher +} + +class RepositoryImpl: ObservableObject, Repository { + + // MARK: EasyFirebaseSwift + private let firestore: FirestoreClient = FirestoreClient() + private let storage: StorageClient = StorageClient.shared + private let auth: FirebaseAuthClient = FirebaseAuthClient() + private let appleAuth: AppleAuthClient = AppleAuthClient() + + /// Sort documents with `postedAt`. + private let order = DefaultFirestoreQueryOrder( + fieldPath: "postedAt", + isAscending: false + ) + /// `avatars` Folder in FirebaseStrorage + private let folder: HomeFolder = { + var folder = HomeFolder() + folder.name = "avatars" + return folder + }() + + // MARK: - Protocol Confirmance + + // MARK: Message + var messages: AnyPublisher<[Message], Never> { + // Create param, `SnapshotInputParameter.Default`. + let param: SnapshotInputParameter.Default = .init( + filter: [], + order: [order], + limit: nil + ) + return Message.multiple( + for: .snapshots(param) + ) + .replaceError(with: []) + .eraseToAnyPublisher() + } + + func saveMessage(_ message: Message) async throws { + _ = try await firestore.create(message) + } + + func fetchMessages(of userID: String) async throws -> [Message] { + // Create Filter + let filter = FirestoreEqualFilter( + fieldPath: "senderID", + value: userID + ) + // Call `get` method + let messages: [Message] = try await firestore.get( + filter: [filter], + includeCache: true, + order: [order], + limit: nil + ) + return messages + } + + func deleteMessage(_ message: Message) async throws { + try await firestore.delete(message) + } + + func updateMessage(message: Message) async throws { + try await firestore.update(message) + } + + + // MARK: Auth + var isLoggedIn: AnyPublisher { + auth.user + .map({ $0 != nil }) + .replaceError(with: false) + .eraseToAnyPublisher() + } + + // Mapping Combine to async/await + func signIn() async throws { + var iterator = auth.signInAnonymously() + .values + .makeAsyncIterator() + _ = try await iterator.next() + } + + func signOut() async throws { + var iterator = auth.signOut() + .values + .makeAsyncIterator() + _ = try await iterator.next() + } + + // MARK: User + var uid: AnyPublisher { + auth.user + .map({ $0?.uid ?? "" }) + .replaceError(with: "") + .eraseToAnyPublisher() + } + func fetchAvatar() -> AnyPublisher { + let uid = auth.uid ?? "" + let resource = Resource( + name: uid, + folder: folder, + metadata: .init(contentType: .jpeg), + data: nil + ) + return resource.download() + } + + func setupAvatar(of userID: String, image: Data) -> AnyPublisher { + let resource = Resource( + name: userID, + folder: folder, + metadata: .init(contentType: .jpeg), + data: image + ) + return resource.uploadViaFile() + } +} diff --git a/Examples/Practical/MessageApp/Shared/ContentView.swift b/Examples/Practical/MessageApp/Shared/RootView.swift similarity index 68% rename from Examples/Practical/MessageApp/Shared/ContentView.swift rename to Examples/Practical/MessageApp/Shared/RootView.swift index 8806020..f6c4a02 100644 --- a/Examples/Practical/MessageApp/Shared/ContentView.swift +++ b/Examples/Practical/MessageApp/Shared/RootView.swift @@ -1,5 +1,5 @@ // -// ContentView.swift +// RootView.swift // Shared // // Created by Fumiya Tanaka on 2022/04/21. @@ -7,7 +7,10 @@ import SwiftUI -struct ContentView: View { +struct RootView: View { + + @EnvironmentObject var repository: RepositoryImpl + var body: some View { Text("Hello, world!") .padding() @@ -16,6 +19,6 @@ struct ContentView: View { struct ContentView_Previews: PreviewProvider { static var previews: some View { - ContentView() + RootView() } }