From c506cef20c8511607dd423150a8ebbfbbf1faf52 Mon Sep 17 00:00:00 2001 From: Dariusz Rybicki <dariusz@elixxir.io> Date: Wed, 8 Jun 2022 12:40:21 +0200 Subject: [PATCH] Add MyIdentityFeature library to example app --- .../xcschemes/MyIdentityFeature.xcscheme | 78 +++++++++++++++++++ .../xcschemes/example-app.xcscheme | 24 ++++++ Example/example-app/Package.swift | 21 +++++ .../MyIdentityFeature/MyIdentityFeature.swift | 19 +++++ .../MyIdentityFeature/MyIdentityView.swift | 35 +++++++++ .../MyIdentityFeatureTests.swift | 9 +++ 6 files changed, 186 insertions(+) create mode 100644 Example/example-app/.swiftpm/xcode/xcshareddata/xcschemes/MyIdentityFeature.xcscheme create mode 100644 Example/example-app/Sources/MyIdentityFeature/MyIdentityFeature.swift create mode 100644 Example/example-app/Sources/MyIdentityFeature/MyIdentityView.swift create mode 100644 Example/example-app/Tests/MyIdentityFeatureTests/MyIdentityFeatureTests.swift diff --git a/Example/example-app/.swiftpm/xcode/xcshareddata/xcschemes/MyIdentityFeature.xcscheme b/Example/example-app/.swiftpm/xcode/xcshareddata/xcschemes/MyIdentityFeature.xcscheme new file mode 100644 index 00000000..e69b1d44 --- /dev/null +++ b/Example/example-app/.swiftpm/xcode/xcshareddata/xcschemes/MyIdentityFeature.xcscheme @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "1340" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + <BuildActionEntries> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "MyIdentityFeature" + BuildableName = "MyIdentityFeature" + BlueprintName = "MyIdentityFeature" + 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 = "MyIdentityFeatureTests" + BuildableName = "MyIdentityFeatureTests" + BlueprintName = "MyIdentityFeatureTests" + 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 = "MyIdentityFeature" + BuildableName = "MyIdentityFeature" + BlueprintName = "MyIdentityFeature" + ReferencedContainer = "container:"> + </BuildableReference> + </MacroExpansion> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> diff --git a/Example/example-app/.swiftpm/xcode/xcshareddata/xcschemes/example-app.xcscheme b/Example/example-app/.swiftpm/xcode/xcshareddata/xcschemes/example-app.xcscheme index ac213623..1a4d13ff 100644 --- a/Example/example-app/.swiftpm/xcode/xcshareddata/xcschemes/example-app.xcscheme +++ b/Example/example-app/.swiftpm/xcode/xcshareddata/xcschemes/example-app.xcscheme @@ -48,6 +48,20 @@ ReferencedContainer = "container:"> </BuildableReference> </BuildActionEntry> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "MyIdentityFeature" + BuildableName = "MyIdentityFeature" + BlueprintName = "MyIdentityFeature" + ReferencedContainer = "container:"> + </BuildableReference> + </BuildActionEntry> <BuildActionEntry buildForTesting = "YES" buildForRunning = "YES" @@ -101,6 +115,16 @@ ReferencedContainer = "container:"> </BuildableReference> </TestableReference> + <TestableReference + skipped = "NO"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "MyIdentityFeatureTests" + BuildableName = "MyIdentityFeatureTests" + BlueprintName = "MyIdentityFeatureTests" + ReferencedContainer = "container:"> + </BuildableReference> + </TestableReference> <TestableReference skipped = "NO"> <BuildableReference diff --git a/Example/example-app/Package.swift b/Example/example-app/Package.swift index 55d54626..cb8aead7 100644 --- a/Example/example-app/Package.swift +++ b/Example/example-app/Package.swift @@ -32,6 +32,10 @@ let package = Package( name: "LandingFeature", targets: ["LandingFeature"] ), + .library( + name: "MyIdentityFeature", + targets: ["MyIdentityFeature"] + ), .library( name: "SessionFeature", targets: ["SessionFeature"] @@ -132,6 +136,23 @@ let package = Package( ], swiftSettings: swiftSettings ), + .target( + name: "MyIdentityFeature", + dependencies: [ + .product( + name: "ComposableArchitecture", + package: "swift-composable-architecture" + ), + ], + swiftSettings: swiftSettings + ), + .testTarget( + name: "MyIdentityFeatureTests", + dependencies: [ + .target(name: "MyIdentityFeature"), + ], + swiftSettings: swiftSettings + ), .target( name: "SessionFeature", dependencies: [ diff --git a/Example/example-app/Sources/MyIdentityFeature/MyIdentityFeature.swift b/Example/example-app/Sources/MyIdentityFeature/MyIdentityFeature.swift new file mode 100644 index 00000000..a9b97361 --- /dev/null +++ b/Example/example-app/Sources/MyIdentityFeature/MyIdentityFeature.swift @@ -0,0 +1,19 @@ +import ComposableArchitecture + +public struct MyIdentityState: Equatable { + public init() {} +} + +public enum MyIdentityAction: Equatable {} + +public struct MyIdentityEnvironment { + public init() {} +} + +public let myIdentityReducer = Reducer<MyIdentityState, MyIdentityAction, MyIdentityEnvironment>.empty + +#if DEBUG +extension MyIdentityEnvironment { + public static let failing = MyIdentityEnvironment() +} +#endif diff --git a/Example/example-app/Sources/MyIdentityFeature/MyIdentityView.swift b/Example/example-app/Sources/MyIdentityFeature/MyIdentityView.swift new file mode 100644 index 00000000..4061024b --- /dev/null +++ b/Example/example-app/Sources/MyIdentityFeature/MyIdentityView.swift @@ -0,0 +1,35 @@ +import ComposableArchitecture +import SwiftUI + +public struct MyIdentityView: View { + public init(store: Store<MyIdentityState, MyIdentityAction>) { + self.store = store + } + + let store: Store<MyIdentityState, MyIdentityAction> + + struct ViewState: Equatable { + init(state: MyIdentityState) {} + } + + public var body: some View { + WithViewStore(store.scope(state: ViewState.init)) { viewStore in + Text("MyIdentityView") + } + } +} + +#if DEBUG +public struct MyIdentityView_Previews: PreviewProvider { + public static var previews: some View { + NavigationView { + MyIdentityView(store: .init( + initialState: .init(), + reducer: .empty, + environment: () + )) + } + .navigationViewStyle(.stack) + } +} +#endif diff --git a/Example/example-app/Tests/MyIdentityFeatureTests/MyIdentityFeatureTests.swift b/Example/example-app/Tests/MyIdentityFeatureTests/MyIdentityFeatureTests.swift new file mode 100644 index 00000000..f4a6a410 --- /dev/null +++ b/Example/example-app/Tests/MyIdentityFeatureTests/MyIdentityFeatureTests.swift @@ -0,0 +1,9 @@ +import ComposableArchitecture +import XCTest +@testable import MyIdentityFeature + +final class MyIdentityFeatureTests: XCTestCase { + func testExample() { + XCTAssert(true) + } +} -- GitLab