From 946ef9d0bae4d0065b971b56d556cc7893cba7da Mon Sep 17 00:00:00 2001 From: Dariusz Rybicki <dariusz@elixxir.io> Date: Sun, 11 Sep 2022 22:29:59 +0200 Subject: [PATCH] Add VerifyContactFeature library --- .../xcschemes/VerifyContactFeature.xcscheme | 78 +++++++++++++++++++ Examples/xx-messenger/Package.swift | 13 ++++ .../xcschemes/XXMessenger.xcscheme | 10 +++ .../VerifyContactFeature.swift | 28 +++++++ .../VerifyContactView.swift | 36 +++++++++ .../VerifyContactFeatureTests.swift | 15 ++++ 6 files changed, 180 insertions(+) create mode 100644 Examples/xx-messenger/.swiftpm/xcode/xcshareddata/xcschemes/VerifyContactFeature.xcscheme create mode 100644 Examples/xx-messenger/Sources/VerifyContactFeature/VerifyContactFeature.swift create mode 100644 Examples/xx-messenger/Sources/VerifyContactFeature/VerifyContactView.swift create mode 100644 Examples/xx-messenger/Tests/VerifyContactFeatureTests/VerifyContactFeatureTests.swift diff --git a/Examples/xx-messenger/.swiftpm/xcode/xcshareddata/xcschemes/VerifyContactFeature.xcscheme b/Examples/xx-messenger/.swiftpm/xcode/xcshareddata/xcschemes/VerifyContactFeature.xcscheme new file mode 100644 index 00000000..54cf617e --- /dev/null +++ b/Examples/xx-messenger/.swiftpm/xcode/xcshareddata/xcschemes/VerifyContactFeature.xcscheme @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "1400" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + <BuildActionEntries> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "VerifyContactFeature" + BuildableName = "VerifyContactFeature" + BlueprintName = "VerifyContactFeature" + ReferencedContainer = "container:"> + </BuildableReference> + </BuildActionEntry> + </BuildActionEntries> + </BuildAction> + <TestAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + shouldUseLaunchSchemeArgsEnv = "YES" + codeCoverageEnabled = "YES"> + <Testables> + <TestableReference + skipped = "NO"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "VerifyContactFeatureTests" + BuildableName = "VerifyContactFeatureTests" + BlueprintName = "VerifyContactFeatureTests" + ReferencedContainer = "container:"> + </BuildableReference> + </TestableReference> + </Testables> + </TestAction> + <LaunchAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES"> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + debugDocumentVersioning = "YES"> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "VerifyContactFeature" + BuildableName = "VerifyContactFeature" + BlueprintName = "VerifyContactFeature" + ReferencedContainer = "container:"> + </BuildableReference> + </MacroExpansion> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> diff --git a/Examples/xx-messenger/Package.swift b/Examples/xx-messenger/Package.swift index 57081f3e..8c7a1c90 100644 --- a/Examples/xx-messenger/Package.swift +++ b/Examples/xx-messenger/Package.swift @@ -27,6 +27,7 @@ let package = Package( .library(name: "RestoreFeature", targets: ["RestoreFeature"]), .library(name: "SendRequestFeature", targets: ["SendRequestFeature"]), .library(name: "UserSearchFeature", targets: ["UserSearchFeature"]), + .library(name: "VerifyContactFeature", targets: ["VerifyContactFeature"]), .library(name: "WelcomeFeature", targets: ["WelcomeFeature"]), ], dependencies: [ @@ -223,6 +224,18 @@ let package = Package( ], swiftSettings: swiftSettings ), + .target( + name: "VerifyContactFeature", + dependencies: [ + .product(name: "ComposableArchitecture", package: "swift-composable-architecture"), + ] + ), + .testTarget( + name: "VerifyContactFeatureTests", + dependencies: [ + .target(name: "VerifyContactFeature"), + ] + ), .target( name: "WelcomeFeature", dependencies: [ diff --git a/Examples/xx-messenger/Project/XXMessenger.xcodeproj/xcshareddata/xcschemes/XXMessenger.xcscheme b/Examples/xx-messenger/Project/XXMessenger.xcodeproj/xcshareddata/xcschemes/XXMessenger.xcscheme index 9d31f6f7..71af5875 100644 --- a/Examples/xx-messenger/Project/XXMessenger.xcodeproj/xcshareddata/xcschemes/XXMessenger.xcscheme +++ b/Examples/xx-messenger/Project/XXMessenger.xcodeproj/xcshareddata/xcschemes/XXMessenger.xcscheme @@ -119,6 +119,16 @@ ReferencedContainer = "container:.."> </BuildableReference> </TestableReference> + <TestableReference + skipped = "NO"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "VerifyContactFeatureTests" + BuildableName = "VerifyContactFeatureTests" + BlueprintName = "VerifyContactFeatureTests" + ReferencedContainer = "container:.."> + </BuildableReference> + </TestableReference> <TestableReference skipped = "NO"> <BuildableReference diff --git a/Examples/xx-messenger/Sources/VerifyContactFeature/VerifyContactFeature.swift b/Examples/xx-messenger/Sources/VerifyContactFeature/VerifyContactFeature.swift new file mode 100644 index 00000000..c657dd72 --- /dev/null +++ b/Examples/xx-messenger/Sources/VerifyContactFeature/VerifyContactFeature.swift @@ -0,0 +1,28 @@ +import ComposableArchitecture +import XCTestDynamicOverlay + +public struct VerifyContactState: Equatable { + public init() {} +} + +public enum VerifyContactAction: Equatable { + case start +} + +public struct VerifyContactEnvironment { + public init() {} +} + +#if DEBUG +extension VerifyContactEnvironment { + public static let unimplemented = VerifyContactEnvironment() +} +#endif + +public let verifyContactReducer = Reducer<VerifyContactState, VerifyContactAction, VerifyContactEnvironment> +{ state, action, env in + switch action { + case .start: + return .none + } +} diff --git a/Examples/xx-messenger/Sources/VerifyContactFeature/VerifyContactView.swift b/Examples/xx-messenger/Sources/VerifyContactFeature/VerifyContactView.swift new file mode 100644 index 00000000..ff2d76b2 --- /dev/null +++ b/Examples/xx-messenger/Sources/VerifyContactFeature/VerifyContactView.swift @@ -0,0 +1,36 @@ +import ComposableArchitecture +import SwiftUI + +public struct VerifyContactView: View { + public init(store: Store<VerifyContactState, VerifyContactAction>) { + self.store = store + } + + let store: Store<VerifyContactState, VerifyContactAction> + + struct ViewState: Equatable { + init(state: VerifyContactState) {} + } + + public var body: some View { + WithViewStore(store, observe: ViewState.init) { viewStore in + Form { + + } + .navigationTitle("Verify Contact") + .task { viewStore.send(.start) } + } + } +} + +#if DEBUG +public struct VerifyContactView_Previews: PreviewProvider { + public static var previews: some View { + VerifyContactView(store: Store( + initialState: VerifyContactState(), + reducer: .empty, + environment: () + )) + } +} +#endif diff --git a/Examples/xx-messenger/Tests/VerifyContactFeatureTests/VerifyContactFeatureTests.swift b/Examples/xx-messenger/Tests/VerifyContactFeatureTests/VerifyContactFeatureTests.swift new file mode 100644 index 00000000..b0f41108 --- /dev/null +++ b/Examples/xx-messenger/Tests/VerifyContactFeatureTests/VerifyContactFeatureTests.swift @@ -0,0 +1,15 @@ +import ComposableArchitecture +import XCTest +@testable import VerifyContactFeature + +final class VerifyContactFeatureTests: XCTestCase { + func testStart() { + let store = TestStore( + initialState: VerifyContactState(), + reducer: verifyContactReducer, + environment: .unimplemented + ) + + store.send(.start) + } +} -- GitLab