From 662bbc746b4b7df86e6e36617ffcd01b439f62cc Mon Sep 17 00:00:00 2001 From: tomokisun Date: Wed, 22 Nov 2023 17:53:04 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20create=20invitation=20co?= =?UTF-8?q?de?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OnboardFeature/InvitationCode.swift | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Packages/GodPackage/Sources/OnboardFeature/InvitationCode.swift diff --git a/Packages/GodPackage/Sources/OnboardFeature/InvitationCode.swift b/Packages/GodPackage/Sources/OnboardFeature/InvitationCode.swift new file mode 100644 index 00000000..f5e71d95 --- /dev/null +++ b/Packages/GodPackage/Sources/OnboardFeature/InvitationCode.swift @@ -0,0 +1,61 @@ +import AnalyticsClient +import ComposableArchitecture +import SwiftUI + +@Reducer +public struct InvitationCodeLogic { + public init() {} + + public struct State: Equatable { + public init() {} + } + + public enum Action: Equatable { + case onTask + case onAppear + } + + @Dependency(\.analytics) var analytics + + public var body: some Reducer { + Reduce { _, action in + switch action { + case .onTask: + return .none + + case .onAppear: + analytics.logScreen(screenName: "InvitationCode", of: self) + return .none + } + } + } +} + +public struct InvitationCodeView: View { + let store: StoreOf + + public init(store: StoreOf) { + self.store = store + } + + public var body: some View { + WithViewStore(store, observe: { $0 }) { viewStore in + List { + Text("InvitationCode", bundle: .module) + } + .navigationTitle("InvitationCode") + .navigationBarTitleDisplayMode(.inline) + .task { await store.send(.onTask).finish() } + .onAppear { store.send(.onAppear) } + } + } +} + +#Preview { + InvitationCodeView( + store: .init( + initialState: InvitationCodeLogic.State(), + reducer: { InvitationCodeLogic() } + ) + ) +}