From 341fe928fe9ead09e3ef0485c4e8afe29a460e4d Mon Sep 17 00:00:00 2001 From: Dariusz Rybicki <dariusz@elixxir.io> Date: Wed, 30 Nov 2022 10:07:40 +0100 Subject: [PATCH] Add GroupsFeature library to example --- .../xcschemes/GroupsFeature.xcscheme | 78 +++++++++++++++++++ Examples/xx-messenger/Package.swift | 21 +++++ .../xcschemes/XXMessenger.xcscheme | 10 +++ .../GroupsFeature/GroupsComponent.swift | 20 +++++ .../Sources/GroupsFeature/GroupsView.swift | 39 ++++++++++ .../GroupsComponentTests.swift | 14 ++++ 6 files changed, 182 insertions(+) create mode 100644 Examples/xx-messenger/.swiftpm/xcode/xcshareddata/xcschemes/GroupsFeature.xcscheme create mode 100644 Examples/xx-messenger/Sources/GroupsFeature/GroupsComponent.swift create mode 100644 Examples/xx-messenger/Sources/GroupsFeature/GroupsView.swift create mode 100644 Examples/xx-messenger/Tests/GroupsFeatureTests/GroupsComponentTests.swift diff --git a/Examples/xx-messenger/.swiftpm/xcode/xcshareddata/xcschemes/GroupsFeature.xcscheme b/Examples/xx-messenger/.swiftpm/xcode/xcshareddata/xcschemes/GroupsFeature.xcscheme new file mode 100644 index 00000000..65b9cc33 --- /dev/null +++ b/Examples/xx-messenger/.swiftpm/xcode/xcshareddata/xcschemes/GroupsFeature.xcscheme @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "1410" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + <BuildActionEntries> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "GroupsFeature" + BuildableName = "GroupsFeature" + BlueprintName = "GroupsFeature" + 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 = "GroupsFeatureTests" + BuildableName = "GroupsFeatureTests" + BlueprintName = "GroupsFeatureTests" + 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 = "GroupsFeature" + BuildableName = "GroupsFeature" + BlueprintName = "GroupsFeature" + 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 63e8b36b..edfeba7e 100644 --- a/Examples/xx-messenger/Package.swift +++ b/Examples/xx-messenger/Package.swift @@ -22,6 +22,7 @@ let package = Package( .library(name: "ContactFeature", targets: ["ContactFeature"]), .library(name: "ContactLookupFeature", targets: ["ContactLookupFeature"]), .library(name: "ContactsFeature", targets: ["ContactsFeature"]), + .library(name: "GroupsFeature", targets: ["GroupsFeature"]), .library(name: "HomeFeature", targets: ["HomeFeature"]), .library(name: "MyContactFeature", targets: ["MyContactFeature"]), .library(name: "RegisterFeature", targets: ["RegisterFeature"]), @@ -260,6 +261,26 @@ let package = Package( ], swiftSettings: swiftSettings ), + .target( + name: "GroupsFeature", + dependencies: [ + .target(name: "AppCore"), + .product(name: "ComposableArchitecture", package: "swift-composable-architecture"), + .product(name: "ComposablePresentation", package: "swift-composable-presentation"), + .product(name: "XXClient", package: "elixxir-dapps-sdk-swift"), + .product(name: "XXMessengerClient", package: "elixxir-dapps-sdk-swift"), + .product(name: "XXModels", package: "client-ios-db"), + ], + swiftSettings: swiftSettings + ), + .testTarget( + name: "GroupsFeatureTests", + dependencies: [ + .target(name: "GroupsFeature"), + .product(name: "CustomDump", package: "swift-custom-dump"), + ], + swiftSettings: swiftSettings + ), .target( name: "HomeFeature", 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 aef30c31..71d6d8c4 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 = "GroupsFeatureTests" + BuildableName = "GroupsFeatureTests" + BlueprintName = "GroupsFeatureTests" + ReferencedContainer = "container:.."> + </BuildableReference> + </TestableReference> <TestableReference skipped = "NO"> <BuildableReference diff --git a/Examples/xx-messenger/Sources/GroupsFeature/GroupsComponent.swift b/Examples/xx-messenger/Sources/GroupsFeature/GroupsComponent.swift new file mode 100644 index 00000000..c1facc4e --- /dev/null +++ b/Examples/xx-messenger/Sources/GroupsFeature/GroupsComponent.swift @@ -0,0 +1,20 @@ +import ComposableArchitecture + +public struct GroupsComponent: ReducerProtocol { + public struct State: Equatable { + public init() {} + } + + public enum Action: Equatable { + case start + } + + public var body: some ReducerProtocol<State, Action> { + Reduce { state, action in + switch action { + case .start: + return .none + } + } + } +} diff --git a/Examples/xx-messenger/Sources/GroupsFeature/GroupsView.swift b/Examples/xx-messenger/Sources/GroupsFeature/GroupsView.swift new file mode 100644 index 00000000..38cbefbe --- /dev/null +++ b/Examples/xx-messenger/Sources/GroupsFeature/GroupsView.swift @@ -0,0 +1,39 @@ +import ComposableArchitecture +import SwiftUI + +public struct GroupsView: View { + public typealias Component = GroupsComponent + + public init(store: StoreOf<Component>) { + self.store = store + } + + let store: StoreOf<Component> + + struct ViewState: Equatable { + init(state: Component.State) {} + } + + public var body: some View { + WithViewStore(store, observe: ViewState.init) { viewStore in + Form { + + } + .navigationTitle("Groups") + .task { viewStore.send(.start) } + } + } +} + +#if DEBUG +public struct GroupsView_Previews: PreviewProvider { + public static var previews: some View { + NavigationView { + GroupsView(store: Store( + initialState: GroupsComponent.State(), + reducer: EmptyReducer() + )) + } + } +} +#endif diff --git a/Examples/xx-messenger/Tests/GroupsFeatureTests/GroupsComponentTests.swift b/Examples/xx-messenger/Tests/GroupsFeatureTests/GroupsComponentTests.swift new file mode 100644 index 00000000..be3456a9 --- /dev/null +++ b/Examples/xx-messenger/Tests/GroupsFeatureTests/GroupsComponentTests.swift @@ -0,0 +1,14 @@ +import ComposableArchitecture +import XCTest +@testable import GroupsFeature + +final class GroupsComponentTests: XCTestCase { + func testStart() { + let store = TestStore( + initialState: GroupsComponent.State(), + reducer: GroupsComponent() + ) + + store.send(.start) + } +} -- GitLab