From acf5b86d8b68e5a9b30f7cb55b410c243509461d Mon Sep 17 00:00:00 2001 From: Jihyun247 <59338503+Jihyun247@users.noreply.github.com> Date: Wed, 21 Aug 2024 00:11:57 +0900 Subject: [PATCH] =?UTF-8?q?[CAT-290]=20=EB=A7=88=EC=9D=B4=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EB=82=B4=EA=B3=A0=EC=96=91=EC=9D=B4=20Riv?= =?UTF-8?q?e=20=EC=A0=81=EC=9A=A9=20(#46)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyPageFeature/Sources/MyCat/MyCatCore.swift | 9 +++++++++ .../MyPageFeature/Sources/MyCat/MyCatView.swift | 12 +++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Projects/Feature/MyPageFeature/Sources/MyCat/MyCatCore.swift b/Projects/Feature/MyPageFeature/Sources/MyCat/MyCatCore.swift index ab168c3..c533cad 100644 --- a/Projects/Feature/MyPageFeature/Sources/MyCat/MyCatCore.swift +++ b/Projects/Feature/MyPageFeature/Sources/MyCat/MyCatCore.swift @@ -8,8 +8,10 @@ import CatFeature import CatServiceInterface +import DesignSystem import ComposableArchitecture +import RiveRuntime @Reducer public struct MyCatCore { @@ -17,11 +19,13 @@ public struct MyCatCore { public struct State: Equatable { var cat: AnyCat var tooltip: MyCatTooltip? = .init() + var catRiv: RiveViewModel = Rive.catSelectRiv(stateMachineName: "State Machine_selectCat") @Presents var selectCat: SelectCatCore.State? @Presents var namingCat: NamingCatCore.State? } public enum Action { + case onAppear case setTooltip(MyCatTooltip?) case changeCatButtonTapped case changeCatNameButtonTapped @@ -46,6 +50,11 @@ public struct MyCatCore { private func core(state: inout State, action: Action) -> EffectOf { switch action { + case .onAppear: + state.catRiv.stop() + state.catRiv.triggerInput(state.cat.rivTriggerName) + return .none + case .setTooltip: return .none diff --git a/Projects/Feature/MyPageFeature/Sources/MyCat/MyCatView.swift b/Projects/Feature/MyPageFeature/Sources/MyCat/MyCatView.swift index 72fb25e..f45d4da 100644 --- a/Projects/Feature/MyPageFeature/Sources/MyCat/MyCatView.swift +++ b/Projects/Feature/MyPageFeature/Sources/MyCat/MyCatView.swift @@ -28,13 +28,8 @@ public struct MyCatView: View { VStack { Spacer() VStack(spacing: Alias.Spacing.medium) { - ZStack { - Rectangle() - .foregroundStyle(Alias.Color.Background.secondary) - .frame(maxHeight: .infinity) - store.cat.catImage - .setTooltipTarget(tooltip: MyCatTooltip.self) - } + store.catRiv.view() + .setTooltipTarget(tooltip: MyCatTooltip.self) .frame(maxHeight: 240) HStack(spacing: Alias.Spacing.xSmall) { @@ -69,5 +64,8 @@ public struct MyCatView: View { ) { store in NamingCatView(store: store) } + .onAppear { + store.send(.onAppear) + } } }