From d5a9c75efbfff4f20d512504b1b36b5166332b04 Mon Sep 17 00:00:00 2001 From: "emre.kartal" Date: Wed, 27 Dec 2023 19:44:26 +0100 Subject: [PATCH] Add a framework projet for the DI --- .../contents.xcworkspacedata | 3 + Sources/AllInApp/AllIn/AllInApp.swift | 1 + Sources/AllInApp/AllIn/ContentView.swift | 1 + .../AllIn/ViewModels/LoginViewModel.swift | 1 + .../AllIn/ViewModels/RegisterViewModel.swift | 1 + .../AllInApp.xcodeproj/project.pbxproj | 34 +- .../project.pbxproj | 486 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../DependencyInjection.md | 13 + .../DependencyInjection/DependencyInjection.h | 18 + .../DependencyInjection.swift} | 20 +- .../DependencyInjectionTests.swift | 36 ++ 13 files changed, 615 insertions(+), 14 deletions(-) create mode 100644 Sources/DependencyInjection/DependencyInjection.xcodeproj/project.pbxproj create mode 100644 Sources/DependencyInjection/DependencyInjection.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 Sources/DependencyInjection/DependencyInjection.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100755 Sources/DependencyInjection/DependencyInjection/DependencyInjection.docc/DependencyInjection.md create mode 100644 Sources/DependencyInjection/DependencyInjection/DependencyInjection.h rename Sources/{AllInApp/AllIn/Models/DependancyInjection.swift => DependencyInjection/DependencyInjection/DependencyInjection.swift} (68%) create mode 100644 Sources/DependencyInjection/DependencyInjectionTests/DependencyInjectionTests.swift diff --git a/Sources/AllIn.xcworkspace/contents.xcworkspacedata b/Sources/AllIn.xcworkspace/contents.xcworkspacedata index 63d1fa8..2a84f3c 100644 --- a/Sources/AllIn.xcworkspace/contents.xcworkspacedata +++ b/Sources/AllIn.xcworkspace/contents.xcworkspacedata @@ -1,6 +1,9 @@ + + diff --git a/Sources/AllInApp/AllIn/AllInApp.swift b/Sources/AllInApp/AllIn/AllInApp.swift index 2840c90..8843e72 100644 --- a/Sources/AllInApp/AllIn/AllInApp.swift +++ b/Sources/AllInApp/AllIn/AllInApp.swift @@ -6,6 +6,7 @@ // import SwiftUI +import DependencyInjection @main struct AllInApp: App { diff --git a/Sources/AllInApp/AllIn/ContentView.swift b/Sources/AllInApp/AllIn/ContentView.swift index f00a6ca..75d6bb9 100644 --- a/Sources/AllInApp/AllIn/ContentView.swift +++ b/Sources/AllInApp/AllIn/ContentView.swift @@ -6,6 +6,7 @@ // import SwiftUI +import DependencyInjection struct ContentView: View { diff --git a/Sources/AllInApp/AllIn/ViewModels/LoginViewModel.swift b/Sources/AllInApp/AllIn/ViewModels/LoginViewModel.swift index 342d479..2d5e698 100644 --- a/Sources/AllInApp/AllIn/ViewModels/LoginViewModel.swift +++ b/Sources/AllInApp/AllIn/ViewModels/LoginViewModel.swift @@ -7,6 +7,7 @@ import Foundation import SwiftUI +import DependencyInjection class LoginViewModel: ObservableObject { diff --git a/Sources/AllInApp/AllIn/ViewModels/RegisterViewModel.swift b/Sources/AllInApp/AllIn/ViewModels/RegisterViewModel.swift index c206362..8cd0aa3 100644 --- a/Sources/AllInApp/AllIn/ViewModels/RegisterViewModel.swift +++ b/Sources/AllInApp/AllIn/ViewModels/RegisterViewModel.swift @@ -7,6 +7,7 @@ import Foundation import SwiftUI +import DependencyInjection class RegisterViewModel: ObservableObject { diff --git a/Sources/AllInApp/AllInApp.xcodeproj/project.pbxproj b/Sources/AllInApp/AllInApp.xcodeproj/project.pbxproj index a726e81..72c1896 100644 --- a/Sources/AllInApp/AllInApp.xcodeproj/project.pbxproj +++ b/Sources/AllInApp/AllInApp.xcodeproj/project.pbxproj @@ -37,7 +37,6 @@ EC6B96B72B24B4CC00FC1C58 /* AllInUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC6B96B62B24B4CC00FC1C58 /* AllInUITests.swift */; }; EC6B96B92B24B4CC00FC1C58 /* AllInUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC6B96B82B24B4CC00FC1C58 /* AllInUITestsLaunchTests.swift */; }; EC6B96C72B24B5A100FC1C58 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC6B96C62B24B5A100FC1C58 /* User.swift */; }; - EC6B96C92B24B69B00FC1C58 /* DependancyInjection.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC6B96C82B24B69B00FC1C58 /* DependancyInjection.swift */; }; EC6B96CC2B24B7E500FC1C58 /* IAuthService.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC6B96CB2B24B7E500FC1C58 /* IAuthService.swift */; }; EC6B96CF2B24B8D900FC1C58 /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC6B96CE2B24B8D900FC1C58 /* Config.swift */; }; EC6B96D12B24BAE800FC1C58 /* AuthService.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC6B96D02B24BAE800FC1C58 /* AuthService.swift */; }; @@ -49,6 +48,8 @@ EC89F7BD2B250D66003821CE /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC89F7BC2B250D66003821CE /* LoginView.swift */; }; ECA9D1C92B2D9ADA0076E0EC /* UserInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECA9D1C82B2D9ADA0076E0EC /* UserInfo.swift */; }; ECA9D1CB2B2DA2320076E0EC /* DropDownFriends.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECA9D1CA2B2DA2320076E0EC /* DropDownFriends.swift */; }; + ECB357312B3CA69300045D41 /* DependencyInjection.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ECB357302B3CA69300045D41 /* DependencyInjection.framework */; }; + ECB357322B3CA69300045D41 /* DependencyInjection.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = ECB357302B3CA69300045D41 /* DependencyInjection.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; ECB7BC682B2F1ADF002A6654 /* LoginViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECB7BC672B2F1ADF002A6654 /* LoginViewModel.swift */; }; ECB7BC6A2B2F410A002A6654 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECB7BC692B2F410A002A6654 /* AppDelegate.swift */; }; ECB7BC6C2B2F43EE002A6654 /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECB7BC6B2B2F43EE002A6654 /* AppState.swift */; }; @@ -72,6 +73,20 @@ }; /* End PBXContainerItemProxy section */ +/* Begin PBXCopyFilesBuildPhase section */ + ECB357332B3CA69300045D41 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ECB357322B3CA69300045D41 /* DependencyInjection.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ EC0193772B25BF16005D81E6 /* AllcoinsCapsule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllcoinsCapsule.swift; sourceTree = ""; }; EC0193792B25C12B005D81E6 /* BetCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BetCard.swift; sourceTree = ""; }; @@ -106,7 +121,6 @@ EC6B96B62B24B4CC00FC1C58 /* AllInUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllInUITests.swift; sourceTree = ""; }; EC6B96B82B24B4CC00FC1C58 /* AllInUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllInUITestsLaunchTests.swift; sourceTree = ""; }; EC6B96C62B24B5A100FC1C58 /* User.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = ""; }; - EC6B96C82B24B69B00FC1C58 /* DependancyInjection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DependancyInjection.swift; sourceTree = ""; }; EC6B96CB2B24B7E500FC1C58 /* IAuthService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IAuthService.swift; sourceTree = ""; }; EC6B96CE2B24B8D900FC1C58 /* Config.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Config.swift; sourceTree = ""; }; EC6B96D02B24BAE800FC1C58 /* AuthService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthService.swift; sourceTree = ""; }; @@ -118,6 +132,8 @@ EC89F7BC2B250D66003821CE /* LoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = ""; }; ECA9D1C82B2D9ADA0076E0EC /* UserInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserInfo.swift; sourceTree = ""; }; ECA9D1CA2B2DA2320076E0EC /* DropDownFriends.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DropDownFriends.swift; sourceTree = ""; }; + ECB3572E2B3CA3C300045D41 /* DependencyInjection.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = DependencyInjection.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + ECB357302B3CA69300045D41 /* DependencyInjection.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = DependencyInjection.framework; sourceTree = BUILT_PRODUCTS_DIR; }; ECB7BC672B2F1ADF002A6654 /* LoginViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewModel.swift; sourceTree = ""; }; ECB7BC692B2F410A002A6654 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; ECB7BC6B2B2F43EE002A6654 /* AppState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppState.swift; sourceTree = ""; }; @@ -129,6 +145,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + ECB357312B3CA69300045D41 /* DependencyInjection.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -156,6 +173,7 @@ EC6B96AB2B24B4CC00FC1C58 /* AllInTests */, EC6B96B52B24B4CC00FC1C58 /* AllInUITests */, EC6B96992B24B4CC00FC1C58 /* Products */, + ECB3572D2B3CA3BD00045D41 /* Frameworks */, ); sourceTree = ""; }; @@ -219,7 +237,6 @@ isa = PBXGroup; children = ( EC6B96C62B24B5A100FC1C58 /* User.swift */, - EC6B96C82B24B69B00FC1C58 /* DependancyInjection.swift */, ); path = Models; sourceTree = ""; @@ -291,6 +308,15 @@ path = Components; sourceTree = ""; }; + ECB3572D2B3CA3BD00045D41 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ECB357302B3CA69300045D41 /* DependencyInjection.framework */, + ECB3572E2B3CA3C300045D41 /* DependencyInjection.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; ECB7BC662B2F1AAD002A6654 /* ViewModels */ = { isa = PBXGroup; children = ( @@ -310,6 +336,7 @@ EC6B96942B24B4CC00FC1C58 /* Sources */, EC6B96952B24B4CC00FC1C58 /* Frameworks */, EC6B96962B24B4CC00FC1C58 /* Resources */, + ECB357332B3CA69300045D41 /* Embed Frameworks */, ); buildRules = ( ); @@ -449,7 +476,6 @@ EC650A462B25D686003AFCAD /* RankingRow.swift in Sources */, EC01937A2B25C12B005D81E6 /* BetCard.swift in Sources */, EC650A422B25C817003AFCAD /* Friend.swift in Sources */, - EC6B96C92B24B69B00FC1C58 /* DependancyInjection.swift in Sources */, EC7A882F2B28E6BE004F226A /* ConfidentialityButton.swift in Sources */, ECB7BC702B336E28002A6654 /* RegisterViewModel.swift in Sources */, EC650A4C2B25E9C7003AFCAD /* RankingView.swift in Sources */, diff --git a/Sources/DependencyInjection/DependencyInjection.xcodeproj/project.pbxproj b/Sources/DependencyInjection/DependencyInjection.xcodeproj/project.pbxproj new file mode 100644 index 0000000..2c08517 --- /dev/null +++ b/Sources/DependencyInjection/DependencyInjection.xcodeproj/project.pbxproj @@ -0,0 +1,486 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 56; + objects = { + +/* Begin PBXBuildFile section */ + ECB3572C2B3CA37800045D41 /* DependencyInjection.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECB3572B2B3CA37800045D41 /* DependencyInjection.swift */; }; + ECEE18B82B3C9CF400C95E8A /* DependencyInjection.docc in Sources */ = {isa = PBXBuildFile; fileRef = ECEE18B72B3C9CF400C95E8A /* DependencyInjection.docc */; }; + ECEE18BE2B3C9CF400C95E8A /* DependencyInjection.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ECEE18B32B3C9CF400C95E8A /* DependencyInjection.framework */; }; + ECEE18C32B3C9CF400C95E8A /* DependencyInjectionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECEE18C22B3C9CF400C95E8A /* DependencyInjectionTests.swift */; }; + ECEE18C42B3C9CF400C95E8A /* DependencyInjection.h in Headers */ = {isa = PBXBuildFile; fileRef = ECEE18B62B3C9CF400C95E8A /* DependencyInjection.h */; settings = {ATTRIBUTES = (Public, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + ECEE18BF2B3C9CF400C95E8A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = ECEE18AA2B3C9CF400C95E8A /* Project object */; + proxyType = 1; + remoteGlobalIDString = ECEE18B22B3C9CF400C95E8A; + remoteInfo = DependencyInjection; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + ECB3572B2B3CA37800045D41 /* DependencyInjection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DependencyInjection.swift; sourceTree = ""; }; + ECEE18B32B3C9CF400C95E8A /* DependencyInjection.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DependencyInjection.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + ECEE18B62B3C9CF400C95E8A /* DependencyInjection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DependencyInjection.h; sourceTree = ""; }; + ECEE18B72B3C9CF400C95E8A /* DependencyInjection.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = DependencyInjection.docc; sourceTree = ""; }; + ECEE18BD2B3C9CF400C95E8A /* DependencyInjectionTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DependencyInjectionTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + ECEE18C22B3C9CF400C95E8A /* DependencyInjectionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DependencyInjectionTests.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + ECEE18B02B3C9CF400C95E8A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + ECEE18BA2B3C9CF400C95E8A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ECEE18BE2B3C9CF400C95E8A /* DependencyInjection.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + ECEE18A92B3C9CF400C95E8A = { + isa = PBXGroup; + children = ( + ECEE18B52B3C9CF400C95E8A /* DependencyInjection */, + ECEE18C12B3C9CF400C95E8A /* DependencyInjectionTests */, + ECEE18B42B3C9CF400C95E8A /* Products */, + ); + sourceTree = ""; + }; + ECEE18B42B3C9CF400C95E8A /* Products */ = { + isa = PBXGroup; + children = ( + ECEE18B32B3C9CF400C95E8A /* DependencyInjection.framework */, + ECEE18BD2B3C9CF400C95E8A /* DependencyInjectionTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + ECEE18B52B3C9CF400C95E8A /* DependencyInjection */ = { + isa = PBXGroup; + children = ( + ECEE18B62B3C9CF400C95E8A /* DependencyInjection.h */, + ECEE18B72B3C9CF400C95E8A /* DependencyInjection.docc */, + ECB3572B2B3CA37800045D41 /* DependencyInjection.swift */, + ); + path = DependencyInjection; + sourceTree = ""; + }; + ECEE18C12B3C9CF400C95E8A /* DependencyInjectionTests */ = { + isa = PBXGroup; + children = ( + ECEE18C22B3C9CF400C95E8A /* DependencyInjectionTests.swift */, + ); + path = DependencyInjectionTests; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + ECEE18AE2B3C9CF400C95E8A /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ECEE18C42B3C9CF400C95E8A /* DependencyInjection.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + ECEE18B22B3C9CF400C95E8A /* DependencyInjection */ = { + isa = PBXNativeTarget; + buildConfigurationList = ECEE18C72B3C9CF400C95E8A /* Build configuration list for PBXNativeTarget "DependencyInjection" */; + buildPhases = ( + ECEE18AE2B3C9CF400C95E8A /* Headers */, + ECEE18AF2B3C9CF400C95E8A /* Sources */, + ECEE18B02B3C9CF400C95E8A /* Frameworks */, + ECEE18B12B3C9CF400C95E8A /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = DependencyInjection; + productName = DependencyInjection; + productReference = ECEE18B32B3C9CF400C95E8A /* DependencyInjection.framework */; + productType = "com.apple.product-type.framework"; + }; + ECEE18BC2B3C9CF400C95E8A /* DependencyInjectionTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = ECEE18CA2B3C9CF400C95E8A /* Build configuration list for PBXNativeTarget "DependencyInjectionTests" */; + buildPhases = ( + ECEE18B92B3C9CF400C95E8A /* Sources */, + ECEE18BA2B3C9CF400C95E8A /* Frameworks */, + ECEE18BB2B3C9CF400C95E8A /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ECEE18C02B3C9CF400C95E8A /* PBXTargetDependency */, + ); + name = DependencyInjectionTests; + productName = DependencyInjectionTests; + productReference = ECEE18BD2B3C9CF400C95E8A /* DependencyInjectionTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + ECEE18AA2B3C9CF400C95E8A /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1430; + LastUpgradeCheck = 1430; + TargetAttributes = { + ECEE18B22B3C9CF400C95E8A = { + CreatedOnToolsVersion = 14.3.1; + }; + ECEE18BC2B3C9CF400C95E8A = { + CreatedOnToolsVersion = 14.3.1; + }; + }; + }; + buildConfigurationList = ECEE18AD2B3C9CF400C95E8A /* Build configuration list for PBXProject "DependencyInjection" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = ECEE18A92B3C9CF400C95E8A; + productRefGroup = ECEE18B42B3C9CF400C95E8A /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + ECEE18B22B3C9CF400C95E8A /* DependencyInjection */, + ECEE18BC2B3C9CF400C95E8A /* DependencyInjectionTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + ECEE18B12B3C9CF400C95E8A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + ECEE18BB2B3C9CF400C95E8A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + ECEE18AF2B3C9CF400C95E8A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ECB3572C2B3CA37800045D41 /* DependencyInjection.swift in Sources */, + ECEE18B82B3C9CF400C95E8A /* DependencyInjection.docc in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + ECEE18B92B3C9CF400C95E8A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ECEE18C32B3C9CF400C95E8A /* DependencyInjectionTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + ECEE18C02B3C9CF400C95E8A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = ECEE18B22B3C9CF400C95E8A /* DependencyInjection */; + targetProxy = ECEE18BF2B3C9CF400C95E8A /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + ECEE18C52B3C9CF400C95E8A /* 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; + CURRENT_PROJECT_VERSION = 1; + 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"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + ECEE18C62B3C9CF400C95E8A /* 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; + CURRENT_PROJECT_VERSION = 1; + 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"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + ECEE18C82B3C9CF400C95E8A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 16.4; + LD_RUNPATH_SEARCH_PATHS = ( + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = ( + "@executable_path/../Frameworks", + "@loader_path/Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 13.3; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++20"; + PRODUCT_BUNDLE_IDENTIFIER = com.alldev.DependencyInjection; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = auto; + SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + ECEE18C92B3C9CF400C95E8A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + ENABLE_MODULE_VERIFIER = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 16.4; + LD_RUNPATH_SEARCH_PATHS = ( + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = ( + "@executable_path/../Frameworks", + "@loader_path/Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 13.3; + MARKETING_VERSION = 1.0; + MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; + MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu11 gnu++20"; + PRODUCT_BUNDLE_IDENTIFIER = com.alldev.DependencyInjection; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = auto; + SKIP_INSTALL = YES; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + ECEE18CB2B3C9CF400C95E8A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.4; + MACOSX_DEPLOYMENT_TARGET = 13.3; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.alldev.DependencyInjectionTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + ECEE18CC2B3C9CF400C95E8A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 16.4; + MACOSX_DEPLOYMENT_TARGET = 13.3; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.alldev.DependencyInjectionTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + ECEE18AD2B3C9CF400C95E8A /* Build configuration list for PBXProject "DependencyInjection" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + ECEE18C52B3C9CF400C95E8A /* Debug */, + ECEE18C62B3C9CF400C95E8A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + ECEE18C72B3C9CF400C95E8A /* Build configuration list for PBXNativeTarget "DependencyInjection" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + ECEE18C82B3C9CF400C95E8A /* Debug */, + ECEE18C92B3C9CF400C95E8A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + ECEE18CA2B3C9CF400C95E8A /* Build configuration list for PBXNativeTarget "DependencyInjectionTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + ECEE18CB2B3C9CF400C95E8A /* Debug */, + ECEE18CC2B3C9CF400C95E8A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = ECEE18AA2B3C9CF400C95E8A /* Project object */; +} diff --git a/Sources/DependencyInjection/DependencyInjection.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Sources/DependencyInjection/DependencyInjection.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Sources/DependencyInjection/DependencyInjection.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Sources/DependencyInjection/DependencyInjection.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Sources/DependencyInjection/DependencyInjection.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Sources/DependencyInjection/DependencyInjection.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Sources/DependencyInjection/DependencyInjection/DependencyInjection.docc/DependencyInjection.md b/Sources/DependencyInjection/DependencyInjection/DependencyInjection.docc/DependencyInjection.md new file mode 100755 index 0000000..fa1150c --- /dev/null +++ b/Sources/DependencyInjection/DependencyInjection/DependencyInjection.docc/DependencyInjection.md @@ -0,0 +1,13 @@ +# ``DependencyInjection`` + +Summary + +## Overview + +Text + +## Topics + +### Group + +- ``Symbol`` \ No newline at end of file diff --git a/Sources/DependencyInjection/DependencyInjection/DependencyInjection.h b/Sources/DependencyInjection/DependencyInjection/DependencyInjection.h new file mode 100644 index 0000000..2d655f3 --- /dev/null +++ b/Sources/DependencyInjection/DependencyInjection/DependencyInjection.h @@ -0,0 +1,18 @@ +// +// DependencyInjection.h +// DependencyInjection +// +// Created by Emre on 27/12/2023. +// + +#import + +//! Project version number for DependencyInjection. +FOUNDATION_EXPORT double DependencyInjectionVersionNumber; + +//! Project version string for DependencyInjection. +FOUNDATION_EXPORT const unsigned char DependencyInjectionVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/Sources/AllInApp/AllIn/Models/DependancyInjection.swift b/Sources/DependencyInjection/DependencyInjection/DependencyInjection.swift similarity index 68% rename from Sources/AllInApp/AllIn/Models/DependancyInjection.swift rename to Sources/DependencyInjection/DependencyInjection/DependencyInjection.swift index a5cd5fd..1824314 100644 --- a/Sources/AllInApp/AllIn/Models/DependancyInjection.swift +++ b/Sources/DependencyInjection/DependencyInjection/DependencyInjection.swift @@ -1,38 +1,38 @@ // -// DependancyInjection.swift -// AllIn +// DependencyInjection.swift +// DependencyInjection // -// Created by Emre on 20/10/2023. +// Created by Emre on 27/12/2023. // import Foundation -class DependencyInjection { - static var shared = DependencyInjection() +public class DependencyInjection { + public static var shared = DependencyInjection() private var singletons = [String: Any]() @discardableResult - func addSingleton(_ type: T.Type, _ instance: T) -> DependencyInjection { + public func addSingleton(_ type: T.Type, _ instance: T) -> DependencyInjection { let key = String(describing: T.self) singletons[key] = instance return self } - func resolve(_ type: T.Type) -> T? { + public func resolve(_ type: T.Type) -> T? { let key = String(describing: T.self) return singletons[key] as? T } } @propertyWrapper -struct Inject { +public struct Inject { private var value: T? - init() { + public init() { self.value = DependencyInjection.shared.resolve(T.self) } - var wrappedValue: T { + public var wrappedValue: T { get { if let value = value { return value diff --git a/Sources/DependencyInjection/DependencyInjectionTests/DependencyInjectionTests.swift b/Sources/DependencyInjection/DependencyInjectionTests/DependencyInjectionTests.swift new file mode 100644 index 0000000..519ba73 --- /dev/null +++ b/Sources/DependencyInjection/DependencyInjectionTests/DependencyInjectionTests.swift @@ -0,0 +1,36 @@ +// +// DependencyInjectionTests.swift +// DependencyInjectionTests +// +// Created by Emre on 27/12/2023. +// + +import XCTest +@testable import DependencyInjection + +class DependencyInjectionTests: 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. + } + } + +}